bug in gmp_fprintf?

paul zimmermann Paul.Zimmermann at inria.fr
Mon Nov 30 17:26:42 UTC 2015

       Hi Torbjörn,

> It is slow to test these huge operands, and while we do have some big
> machines for GMP testing, there is more work to be done for huge operand
> testing.

the attached test program might be useful. With GMP 6.1.0 and the patch you

zimmerma at berthoud:/tmp/tmp.gxAfwc88A5$ ./a.out 8589934589
GMP version 6.1.0
Checking mpz... ok (print 5964ms, read 32524ms)
a.out: /tmp/e.c:64: main: Assertion `__gmpf_eq (F, G, nbits)' failed.

Adding gmp_printf ("F=%Fe G=%Fe\n", F, G) I get:

F=1.203794e+2585827972 G=5.221003e+5171655960

Btw, reading hex floats with gmp_scanf ("%Fe") seems quite slow, is there
another way?

zimmerma at berthoud:/tmp/tmp.gxAfwc88A5$ ./a.out 85899345
GMP version 6.1.0
Checking mpz... ok (print 60ms, read 332ms)
Checking mpf... ok (print 64ms, read 4020ms)
Checking mpq huge/small...ok (print 56ms, read 332ms)
Checking mpq small/huge...ok (print 56ms, read 336ms)
Checking mpq huge/huge...ok (print 120ms, read 664ms)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: e.c
Type: text/x-csrc
Size: 2920 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20151130/557e725f/attachment.bin>

More information about the gmp-bugs mailing list