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: Andreas Schwab <schwab at suse dot de>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Mar 2003 13:22:30 +0100
- Subject: Re: [PATCH] Fold sqrt comparisons against constants (take 3)
- References: <Pine.LNX.4.44.0303191308110.15075-100000@www.eyesopen.com>
Roger Sayle <roger at www dot eyesopen dot com> writes:
|> 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?
NaN is always unequal to everything, even itself. It's the "itself" part
that makes NaN special.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab at suse dot de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."