gmp integer size limitation

Kate Minola kate01123 at gmail.com
Thu Apr 26 19:29:21 CEST 2012


gmp seems to have a limitation on the size of a multiple-precision
integer.   Is there anything that can be done to remove this
limitation?  Or are there any plans to remove this limitation?

----------------------------------------------------------------------------
#include <stdio.h>
#include "gmp.h"

int main()
{
  unsigned int two=2;
  mp_bitcnt_t e=137438953343;
// mp_bitcnt_t e=137438953344;  // gives "gmp: overflow in mpz type"
  mpz_t pp;

  mpz_init_set_ui(pp, two);
  mpz_mul_2exp(pp,pp,e);
  printf("size=%lu\n", mpz_size(pp));  // says 2147483647 = 2^31-1
}
----------------------------------------------------------------------------

Kate Minola


More information about the gmp-discuss mailing list