mpf_get_str limitation?
Zimmermann Paul
Paul.Zimmermann at loria.fr
Fri Feb 1 16:43:27 CET 2013
Hi,
it seems mpf_get_str cannot deal with numbers of 2^31 bits or more, i.e.,
about 650 million digits, even on a 64-bit computer:
barbecue% cat bug.c
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
int
main (int argc, char *argv[])
{
mpf_t f;
char *s;
mp_exp_t e;
mpf_init2 (f, 2147483585);
mpf_random2 (f, 1, 0);
s = mpf_get_str (NULL, &e, 10, 0, f);
printf ("f=%s*10^%ld\n", s, e);
mpf_clear (f);
return 0;
}
barbecue% gcc bug.c -lgmp
barbecue% ./a.out
GNU MP: Cannot allocate memory (size=5553023287876900142)
Abort (core dumped)
Paul
More information about the gmp-bugs
mailing list