Upper limit?!

Martijn Faassen m.faassen at vet.uu.nl
Mon Aug 30 16:02:36 CEST 1999


David Oppenheimer <davidopp at megsinet.net> wrote:
[alpha allows longer integers]
> Wow, that's quite a difference! on an Alpha you can have a 19 digit number
> as opposed to a 10 digit number on my Pentium.

> So the limit isn't actually
> a factor of the programming language but a virtue (or limitation) of my
> processor.  I wonder if Intel knows about this?!

Intel knows for sure. :) Ever heard of 'merced'? Alpha is a 64 bits processor;
the intel 386, 486, and all pentiums are 32 bits processors. The merced will
be a 64 bits processor. Intel's a bit behind on converting to 64 bits
processors, but of course they have a huge legacy to deal with.

The maximum unsigned integer on a 32 bits processor (that can be held by
a single register and is the normal way to do integer calculations) is
2**32. For signed, one bit is needed to store the sign, so then it's 2**31.

For a 64 bit processor, this is 2**64 (2**63 for signed number). This is quite
a lot more. Really a *lot* lot more. Exponentials. :) 

This also really comes in handy when trying to address physical RAM. An 
address usually needs to fit in a physical register, and this means the
maximum amount of RAM a 32 bits chip can easily address is about 4 gigabytes.
(2**32 / (1024 * 1024)). This isn't a problem yet, but is slowly starting
to become one. With 64 bits we'll be happy for quite a while, it can accomodate
a couple of million *terabyte* just fine. About 16 thousand exabyte or so,
I think. :)

>   LOL  Makes me want to
> sell this hunk of crap Packard Hell P-75, get rid of Win98 and buy an Alpha
> running Linux.   That PSN number thing scares the hell outta me any ways,
> I'm either going AMD or Alpha next go around.

AMD's are 32 bit processors too, though, as far as I'm aware. Anyway, in
practice 32 bits are just fine for most purposes. If you need biiig numbers,
instead of integers you can use Python's long integers (which don't use
processor registers at all). If floating point numbers are fine you can
move on processor speed (if Python didn't slow things down :) -- Intel's
processors have a special floating point section for fast calculations
with these.

Regards,

Martijn





More information about the Python-list mailing list