the need for 64 bits

casevh casevh at gmail.com
Mon Dec 28 10:08:31 EST 2009


On Dec 28, 2:13 am, Mark Dickinson <dicki... at gmail.com> wrote:
> On Dec 28, 6:50 am, Mensanator <mensana... at aol.com> wrote:
>
>
>
> > But with a 64-bit processor, that limitation no longer stops me.
>
> > i: 11   bits: 10,460,353,205   decimals:  3,148,880,080
> > i: 12   bits: 94,143,178,829   decimals: 28,339,920,715
>
> > Wow! 94 billion bits! 28 billion decimal digits!
>
> > Of course, once one wall falls, you get to go up against the next
> > one.
> > For generation 13, I get:
>
> > gmp: overflow in mpz type
> > Abort trap
>
> > Hmm, not sure what "overflow" means in this context, but I suspect
> > it ran out of memory, I probably should have gotten the MacBook Pro
> > with 8 GB of ram. But then, maybe it wouldn't help.
>
> I don't think this was due to running out of memory:  it looks like
> gmp uses the 'int' C type to count the number of limbs in an mpz,
> which would make the maximum number of bits 2**31 * 64, or around 137
> billion, on a typical 64-bit machine.  Maybe there's a configure
> option to change this?
>
> For Python longs, the number of limbs is stored as a signed size_t
> type, so on a 64-bit machine memory really is the only limitation.
>
> --
> Mark

Based on comments on the GMP website, the maximum number of bits on a
64-bit platform is limited to 2**37 or 41 billion decimal digits. A
number this size requires 16GB of RAM. A future version of GMP (5.x)
is supposed to remove that limit and also work well with disk-based
storage.

casevh



More information about the Python-list mailing list