A question about gmp_sprintf() and gmp_sscanf() functions
Paul Zimmermann
Paul.Zimmermann at inria.fr
Wed Jul 29 20:53:43 UTC 2020
Dear Ivan,
> Do you know whether
> gmp_sprintf() and gmp_sscanf() functions can
> be used in a reversible manner.
>
> I mean, can we print a floating
> point number with a given precision in a string and than extract the same floating point number from the string.
> A want not to lose an information (even a bit).
I don't know the answer for GMP, but for this kind of thing I would recommend
using the MPFR function mpfr_get_str with size N=0, which guarantees that if
you read back the generated string (with the same bit precision) you get the
same number.
Paul Zimmermann
More information about the gmp-discuss
mailing list