This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fold sqrt comparisons against constants (take 3)


On Wed, 19 Mar 2003, Geoff Keating wrote:
> > Date: Wed, 19 Mar 2003 12:08:06 -0700 (MST)
> > From: Roger Sayle <roger at www dot eyesopen dot com>
>
> > Unfortunately, not.  sqrt(NaN) != -1  ->  NaN != -1  ->  false
> >                      sqrt(-1)  != -1  ->  NaN != -1  ->  false
>
> NaN != -1 -> true
>
> In fact,
>
> NaN != x -> true for any 'x'.


I believe the logic is the other way around and all comparisons
against NaN always return false, for any of the comparison
operators.  This is why "NaN != x" is not the same as "!(NaN == x)".

But perhaps I'm getting confused?

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]