How Are Unlimited Precision Integers Accomplished?
Peter Hansen
peter at engcorp.com
Thu May 23 20:32:12 EDT 2002
Uncle_Alias wrote:
>
> Paul Rubin <phr-n2002a at nightsong.com> wrote in message news:<7xbsb7zrlc.fsf at ruckus.brouhaha.com>...
> > Yes, Python has a "long" (arbitrary precision integer) type whose size
> > is limited only by the amount of memory available. Python version 2.2
> > uses longs when regular integer calculations overflow. Earlier
> > versions of python will signal an integer overflow error if an
> > integer (normally 32 bits) gets too large. That will happen
> > if you enter an exponent >= 31.
>
> That explains part of my surprise: I'd been using an earlier version
> on the Mac, and am now using 2.2.1 on the PC.
>
> So what fun things can we do with this? Anyone have an algorithm for
> calculating pi?
I've got a really fast one in Python. It completes just as quickly
as any C algorithm for pi. ;-)
-Peter
More information about the Python-list
mailing list