possible bug in mpz_cmp_d

Emmanuel Thomé Emmanuel.Thome at inria.fr
Tue Jul 10 08:30:16 UTC 2018


Hi,

On Mon, Jul 09, 2018 at 11:04:57PM -0600, Tom Tromey wrote:
[...]
>       double d = -2305843009213693953.0;
[...]
> I expect this to print 0, because the numbers are the same, and because
> the number can be exactly represented as a double.

I don't think so.

d is -(2^61+1). You only have 56 bits of mantissa in a double. No way you
can tell apart -(2^61+1) and -(2^61+2). You would need a larger mantissa
for that.

Best,

E.


More information about the gmp-bugs mailing list