in reply to Re^4: test fails on 64bit uselongdouble Perl
in thread test fails on 64bit uselongdouble Perl

The output of my algorithm is an integer

That makes things much easier. You can always just round to the nearest integer at the end, and as long as the numeric error is less than 0.5 you still get the same result.

Perl 6 - links to (nearly) everything that is Perl 6.
  • Comment on Re^5: test fails on 64bit uselongdouble Perl

Replies are listed 'Best First'.
Re^6: test fails on 64bit uselongdouble Perl
by ikegami (Patriarch) on Oct 29, 2009 at 21:48 UTC

    You can always just round to the nearest integer at the end

    Not quite. See my earlier post

      If the desired result is an integer, and the numeric errors are small, there's no need to correctly or robustly round 5.5, so I don't see how your earlier post applies here.
      Perl 6 - links to (nearly) everything that is Perl 6.
        Rounding to the nearest integers gives an error of +/- 1.0 even if the actual error is infinitesimally small. The OP said he's not ok with that.

        The result needs to be an integer but the calculation includes floating-point numbers. Again, my problem is that I'm getting different results on 64bit uselongdouble Perl and may best theory currently is differences in floating-point math on different Perls.