Upper limit?!
Fredrik Lundh
fredrik at pythonware.com
Mon Aug 30 03:56:59 EDT 1999
David Oppenheimer <davidopp at megsinet.net> wrote:
> I was playing around with the command line and discovered that when I
> enter 2 to the 30th power, I get a number back...when I enter 2 to the
> 31st power I get an overflow error. Is 2 to the 30th power near the
> upper limit for computations?!
just above it, on a 32-bit platform. try using
use long integers instead, and compare the
result with the sys.maxint value:
>>> 2L**31
2147483648L
>>> import sys
>>> sys.maxint
2147483647
if you upgrade to an alpha, you'll get:
>>> 2**31
2147483648
>>> import sys
>>> sys.maxint
9223372036854775807
</F>
More information about the Python-list
mailing list