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: pkoning at equallogic dot com, tim at hollebeek dot com
- Cc: dewar at gnat dot com, gcc at gcc dot gnu dot org, geoffk at geoffk dot org,lars at nocrew dot org
- Date: Sun, 7 Jul 2002 19:25:10 -0400 (EDT)
- Subject: Re: Comparing doubles
<<Truncation before compare allows {a==b, b==c, c!=a}, and all other
sorts of unreasonable things. Regardless of whether the standard
strictly requires it or not, it is reasonable to expect equality to be
an equivalence operation.
>>
But it is not necessarily the case that a==a (in the case of a NaN) so
your equivalence relation does not cover NaN's. That's still reasonable,
but it is worth noticing the exception.