Behavior of mpf_eq near zero

tg at tg at
Mon Apr 13 09:31:03 UTC 2015

Alejandro Mallea <janoma at> writes:

  The documentation says that mpf_eq(op1, op2, op3) "returns non-zero if
  the first op3 bits of op1 and op2 are equal", which makes me think
  equality is dangerously tied to the internal representation ("the
  first op3 bits"), but then it says "i.e., test if op1 and op2 are
  approximately equal.", but that is not happening in this case.
The mpf_eq function is not well thought out, but I believe it works
according to its documentation.  Zero is only mpf_eq-equal to itself.

Please don't use this function.  At least use mpf_reldiff, or even
better, use the mpfr GMP extension library.

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list