[Gcl-devel] Bug in mpz_get_d
Paul.Zimmermann at loria.fr
Tue Dec 15 13:19:01 CET 2009
> Please stop writing verbose message with kilobytes of irrelevant copied
> text. This is a bugs mailing list and not a dicussion forum. After
> many long messages, we have yet to see evidence that there is any bug in
> GMP, just evidence of poor reading of documentation, and possibly poor
> understanding of IEEE 754.
here is a tentative to close that issue.
Summary: for input a = 2^1000-1 = 10715086071862673...375, mpz_get_d(a) gives
1.0715086071862672E301, whereas Camm Maguire expected 1.0715086071862673E301.
1) as said in the documentation, mpz_get_d truncates its input, thus 2^1000-1
is truncated to d = 2^1000-2^947, which is the largest 53-bit floating-point
number less or equal to a. We have d = 10715086071862672...048.
2) when printed to 17 figures, d is rounded to nearest, which gives
(Remember that double-precision floating-point numbers are stored in binary.)
Thus I see no bug.
More information about the gmp-bugs