This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Comparing doubles
- From: dewar at gnat dot com (Robert Dewar)
- To: dewar at gnat dot com, pkoning at equallogic dot com
- Cc: gcc at gcc dot gnu dot org, geoffk at geoffk dot org, lars at nocrew dot org
- Date: Sun, 7 Jul 2002 10:55:04 -0400 (EDT)
- Subject: Re: Comparing doubles
<<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.