in reply to Integer overflow

Also:
use integer; $result = 1729080737 + 72 * 14 * 425567; print $result;
But this is possibly a case of misuse integer; instead :-)

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Integer overflow
by almut (Canon) on Apr 24, 2009 at 00:21 UTC

    I think this would only work on 32-bit machines (or rather, 32-bit perls).  At least, on my 64-bit box, I get 2158052273.

      At least, on my 64-bit box, I get 2158052273

      Yes, on my 64-bit build on linux (32-bit architecture) I'd have to use your solution.

      On an architecture where sizeof(long)==8, I would think that neither solution would work. (This is probably, though not necessarily, an irrelevant observation in the context of what the op needs :-)

      Cheers,
        On an architecture where sizeof(long)==8, I would think that neither solution would work.

        I think (or actually, I'm pretty sure, because on my system, sizeof(long)==8) the pack/unpack solution would work, because pack "l" always (by definiton) is 32-bit, independent of what long might be on the system/C compiler, otherwise.