I suspect the problem you're running into is the way perl converts numbers to strings, not the way it's storing them.
By default perl will format numbers as if sprintf()ed with a format of "%.Ng" where N is the value of DBL_DIG for your platform. To check this value run:
perl -MPOSIX -le "print DBL_DIG"On my system this is 15, if it's the same on your platform, this could explain why you're seeing the change when moving from 15 to 16 digits.
To see how perl is actually storing the number use Devel:Peek:
perl -MDevel::Peek -le '$x = 1000000000000000; Dump($x)'For a use64bitint perl this produced:
SV = IV(0x80cba4) at 0x800d1c REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1000000000000000
If you want numbers formatted to higher precision on output, you'll need to either change $#, or use printf with an appropriate format.
In reply to Re: Numeric overloading with 64-bit Perl
by tonyc
in thread Numeric overloading with 64-bit Perl
by jdhedden
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |