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

Rounding to the nearest integers gives an error of +/- 1.0 even if the actual error is infinitesimally small.

I don't believe that. Care to explain?

You do a calculation, and the result is an integer $n. Due to precision limits you get instead $n+$eps, where abs($eps) is small.

Why wouldn't proper rounding return $n, but $n+1 or $n-1? At least that's how I understood your statement that it gives an error of +/- 1.0, which doesn't make sense to me at all.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^10: test fails on 64bit uselongdouble Perl
by ikegami (Patriarch) on Oct 30, 2009 at 15:01 UTC

    You do a calculation, and the result is an integer $n.

    Number $n. You haven't rounded to an integer yet.

    $n = 5.5; $eps = -0.00000000000001; printf "%.0f\n", $n; # 6 expected printf "%.0f\n", $n+$eps; # 5 get

    If his calculations are suppose to always give integers before rounding, then yes, there's no problem.