Inaccurate/inconsistent output from mpf_out_str

paul zimmermann Paul.Zimmermann at
Tue Oct 6 12:55:35 UTC 2015

> Thanks for your reply. I am not familiar with MPFR, but is the original
> behavior the expected one?

I let the GMP developers answer that question. The documentation says:

 -- Function: size_t mpf_out_str (FILE *STREAM, int BASE, size_t
          N_DIGITS, const mpf_t OP)
     Print OP to STREAM, as a string of digits.  Return the number of
     bytes written, or if an error occurred, return 0.


     Up to N_DIGITS will be printed from the mantissa, except that no
     more digits than are accurately representable by OP will be
     printed.  N_DIGITS can be 0 to select that accurate maximum.

but nowhere is said what is the relation between OP and the printed digits.
No specification. No bug. :-)


More information about the gmp-bugs mailing list