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
>>> import sys
>>> sys.maxint

if you upgrade to an alpha, you'll get:

>>> 2**31
>>> import sys
>>> sys.maxint


More information about the Python-list mailing list