Comparing doubles

Robert Dewar dewar@gnat.com
Sun Jul 7 09:20:00 GMT 2002


<<As for compare, I don't claim to know the intricacies of IEEE NaN and
all that, but surely on older float formats at least, compare is
indeed internally just a subtract and test for zero?  Or a normalize
(if applicable) and bitwise compare?  (The latter is definitely the
case on the CDC 6600, to use an old example.)
>>

No, because a subtract and test for zero is subject to problems with both
underflow and overflow and can therefore result in considering unequal
numbers to be equal.



More information about the Gcc mailing list