in reply to Small Perl 6 discoveries III, Ints

Anybody want to try and explain this one?

I find this is a bit interesting.
I can reproduce it on perl-5.26.0 (nvtype=double):
C:\>perl -le "printf '%.0f', 2e25;" 20000000000000001811939328 C:\>perl -le "printf '%.0f', 20e24;" 19999999999999997516972032
It happens because 20e24 is miscalculated (off by one ULP). It's an error that doesn't occur on all of my "double" perls. For example, my perl-5.16.0 is not subject to this issue.

UPDATE: Actually, it occurs on all of my "double" builds of perl that were built using an x86_64 compiler.
I also see the same bug on perl-5.26.0 on Linux (Ubuntu):
$ perl -le 'printf "%.0f\n", 2e25;' 20000000000000001811939328 $ perl -le "printf '%.0f', 20e24;" 19999999999999997516972032

Odd that perl6 should have managed to inherit the same failing.
Are you using a current version of perl6 ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Small Perl 6 discoveries III, Ints
by Anonymous Monk on Sep 29, 2017 at 00:28 UTC
    Rakudo star 2017.07. It's the third and fourth lines that have me scratching my head, though.