bug in gmp_fprintf?

Torbjörn Granlund tg at gmplib.org
Tue Nov 24 20:01:50 UTC 2015

I played more with both the correctness and the performance related to
Paul's bug report.

The gmp_*printf functions are more broken for these huge numbers than
might be evident from executing Paul's example.  The result file is ~4
GiB when it should really be just ~2 GiB.

This is probably related to that all these functions use plain int for
returning sizes.

And the main performance problem is with FreeBSD, actually.  Other BSD's
are many times faster and GNU runs the scanning quite efficiently.

With getc_unlocked, GNU is more than 10 times faster than FreeBSD.  The
difference for plain fgets and getc_unlocked is about 2x with GNU.  We
should use it (under a configure test, as Niels pointed out).

Please encrypt, key id 0xC8601622

More information about the gmp-bugs mailing list