in reply to Re: perls long number problem
in thread perls long number problem

Yep that was what I wanted to show, Perl just couldn't handle the long numbers. I wanted to see if there's another solution than trying to handle numbers as string...

I made some typing mistakes in the code, Sorry for that.

--
My opinions may have changed,
but not the fact that I am right

Replies are listed 'Best First'.
Re: Re: Re: perls long number problem
by gbarr (Monk) on Dec 10, 2001 at 21:24 UTC
    Perl can only handle integers up to the size it was configured with. But it can handle numbers larger that that. Try your example with

    sprintf("%{$len}.0f",$number);

    And you will see the number just fine. This is because perl uses doubles to hold real numbers, which can typically hold numbers of more bits. On most machines perl runs, integers are 32 bits and doubles use 53 bits for the mantissa.

    So yes, perl can handle larger numbers without strings, providing you don't convert them to integers