gmp_asprintf prints wrong exponents for sufficiently big numbers

Torbjorn Granlund tg at
Tue Sep 15 20:30:25 CEST 2009

Uwe Mueller <um.computing at> writes:

  This bug report concerns GMP versions 4.2.1, 4.3.1 and probably also
  others. It contains an attached test program, an error description and a
  suggested patch.
  The issue is shown by the attached test program. It uses two different
  ways to find the string representation of some big numbers. One way
  makes use of the function mpf_get_str, the other uses gmp_asprintf. In
  systems where the size of the type mp_exp_t is larger than that of
  int, the function gmp_asprintf will lead to wrong results for
  sufficiently big numbers.
  The test program does not take any arguments.

Thanks, I applied your suggested patch.


More information about the gmp-bugs mailing list