in reply to Handling large numbers

If you don't need to do any number-crunching on $a, why not use this:
$a = "3000000000000011";

Floating point numbers are imprecise. There are only so many digits of precision available, so you can't expect perl to be able to preserve the last "1" if you do something like this...
print 1000000000000000000000000000001

Replies are listed 'Best First'.
Re: Re: Handling large numbers
by larryk (Friar) on Jun 06, 2001 at 02:50 UTC
    I thought floating point numbers were the computer form of real numbers,
    ie. they have a decimal point
    but 1000000000000000000000000000001 is an integer.

    "Argument is futile - you will be ignorralated!"

      Numbers are always floating-point in perl. Usually. True, you can use integer, but that doesn't seem to take effect until after the parser has chewed the number up and spat it out as a float. On many platforms, 1000000000000000000000000000001 is too big a number to represent as an integer, anyway. Integers have some implementation-dependent maximum number of bits. Computer arithmetic is not the same as mathematical arithmetic. There's always some limit on the size (number of digits) of a number the computer can remember, even if it's the machine's entire virtual memory area.