Behavior of mpf_eq near zero
tg at gmplib.org
tg at gmplib.org
Mon Apr 13 12:19:14 UTC 2015
Vincent Lefevre <vincent at vinc17.net> writes:
The manual poorly specifies this function since it doesn't say what
the first bits of a number are. For instance, the first 3 bits of
0.000
and
0.001
are "0.00" thus are equal. So, you need to introduce the concept
of normalization, and possibly take zero apart since it cannot be
normalized.
I think that interpretation is a bit odd. The same argument would make
17 and 4711 mpf_eq to 10 bits since these numbers are are 000000000010001
and 00000000001001001100111...
> Please don't use this function. At least use mpf_reldiff, or even
> better, use the mpfr GMP extension library.
I agree, though I really think that mpf_eq should be properly
specified. And how about saying that this function is obsolete
and planning to remove it in the future?
I agree with the latter. The function is broken, it has no reasonable
mathematical interpretation. (I take full responsibility for this, since
I wrote it.)
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-discuss
mailing list