https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8028

--- Comment #1 from Loren Wilton <lwil...@earthlink.net> ---
Sidney, you are dealing with roundoff error.

The representation of -2.4 in 64 bit IEEE is 0xc003333333333333.
The top 12 bits are the exponent and mantissa sign, and the remainder is the
mantissa value. As you can deduce from the number above, this is a repeating
fraction, and -2.4 can not be represented exactly.

The standard library math routines try to take roundoff error into account, and
round output numbers to some reasonable number of digits. Sometimes they get
confused for various and sundry reasons.

I'd suggest either accepting a result that is within a small epsilon of the
desired value, or doing a manual round to some reasonable number of digits on
the returned result before the compare.

See https://gregstoll.com/~gregstoll/floattohex/

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to