The limit is in the mpz type. It uses an int for the number of limbs, i.e. limit is 2^32 limbs = 2^38 bits. So your number must be < 2^38.
There are no plans to remove this restriction at the moment. But you can use the mpn functions, which are not so limited. Bill. On 10 June 2012 09:03, Jason Moxham <ja...@thecodecavern.co.uk> wrote: > Hi > > Sorry for the delay. > > I seem to remember that 64bit builds are limited to 2^37 bits (16GB) , I read > it somewhere on the GMP website ,I have no idea which part of MPIR has this > restriction. > > Jason > > > ----------------------------------------------------------- > MPIR-2.5.1 bug > > #include <stdio.h> > #include <stdlib.h> > #include <gmp.h> > > int main(int argc, char *argv[]) > { > // Demonstrates a MPIR bug probably with mpz_mul > // > // Need a computer with at least 60G of memory > // > // % foo > // 3^(2^36) mod 3 equals 0 > // 3^(2^37) mod 3 does NOT equal 0 - Error > > unsigned long p; > unsigned long e=68719476736; // 2^36 > mpz_t pp, b; > > p = 3; // bug does not happen with p = 2 > mpz_init(pp); > mpz_init(b); > // p^(2^36) > mpz_ui_pow_ui(pp,p,e); > // p^(2^36) mod p > mpz_mod_ui(b,pp,p); > printf("%d^(2^36) mod %d ", p, p); > if (mpz_cmp_ui(b,0) == 0) { > printf("equals 0\n"); > } else { > printf("does NOT equal 0 - Error\n"); > exit(0); > } > fflush(stdout); > // square - (p^(2^36))^2 = p^(2^37) > mpz_mul(pp,pp,pp); > // p^(2^37) mod p > mpz_mod_ui(b,pp,p); > printf("%d^(2^37) mod %d ", p, p); > if (mpz_cmp_ui(b,0) == 0) { > printf("equals 0\n"); > } else { > printf("does NOT equal 0 - Error\n"); > exit(0); > } > fflush(stdout); > } > > -- > Kate Minola > > -- > You received this message because you are subscribed to the Google Groups > "mpir-devel" group. > To post to this group, send email to mpir-devel@googlegroups.com. > To unsubscribe from this group, send email to > mpir-devel+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mpir-devel?hl=en. > -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To post to this group, send email to mpir-devel@googlegroups.com. To unsubscribe from this group, send email to mpir-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en.