This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fold sqrt comparisons against constants (take 3)
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: rth at redhat dot com, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Mar 2003 13:12:29 -0700 (MST)
- Subject: 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
--