Comparing doubles

Tim Hollebeek tim@hollebeek.com
Sun Jul 7 22:27:00 GMT 2002


> <<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.

I was going to mention it, but couldn't find a good way of saying
"when restricted to 'real' values."  Thanks.



More information about the Gcc mailing list