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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.