in reply to Exasperated with 64-bit integer builds of perl

FWIW, using int($num) does produce an integer (albeit the wrong one):
$num = 1.44115188075868217e17; print int($num); __END__ 144115188075868224
I get the same number with print int( $string2 ).

This is perl, v5.8.8 built for x86_64-linux-thread-multi

Replies are listed 'Best First'.
Re^2: Exasperated with 64-bit integer builds of perl
by syphilis (Archbishop) on May 28, 2007 at 14:45 UTC
    Hi rhesa,
    As I understand it (and a Devel::Peek::Dump($num) would confirm it), $num is created as a double (53 bits of precision), which of course, can't accurately handle the 58-bit integer 1.44115188075868217e17.

    One of the things I'm wondering is why perl has been set up to assign integral values like 1.44115188075868217e17 to a "double" on 64-bit integer builds - even when 'use integer' is specified. I suspect it's some sort of 32-bit legacy, but I don't really know.

    Thanks for the feedback.

    Cheers,
    Rob