Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #9476

Re: How the computer identify an NaN?

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: How the computer identify an NaN?
Date 2011-08-16 08:42 -0400
Organization A noiseless patient Spider
Message-ID <j2dokj$mli$1@dont-email.me> (permalink)
References <495e8c9c-924e-4cf7-9c54-4b321d92335b@x2g2000yql.googlegroups.com> <0.36e777a2a8fe4a401bbe.20110816043350BST.87vctydo81.fsf@bsb.me.uk> <9d47f418-5533-414f-b9da-15385ce9c442@c19g2000yqe.googlegroups.com>

Show all headers | View raw


On 08/16/2011 12:45 AM, fl wrote:
...
> If NaN won't equal to anything, any number will not equal to itself
> either. ...

That does not follow. There's no connection between those two clauses
that I can see. The first one is true and the second one is false, so
whatever connection you see between those two clauses is invalid.

> ... I still do not understand b_u != b_u;
> 
> ex:
> b_u = 3;
> (b_u!=b_u) ==> 1, right?

No. This is a special rule for NaN's; 3 is not a NaN, so the rule
doesn't apply. Some examples that might clarify this:

 3.0 != 3.0;	// False
 3.0 != 5.0;	// True
 5.0 != 5.0;	// False
 NaN != NaN;	// True
 3.0 != Nan;	// True
 NaN != 5.0;	// True

The special rule, that a NaN doesn't compare equal to anything, applies
to all of the last three statements. It doesn't apply to any of the
first three, because none of the first three statements involve a NaN.
-- 
James Kuyper

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How the computer identify an NaN? fl <rxjwg98@gmail.com> - 2011-08-15 20:19 -0700
  Re: How the computer identify an NaN? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-08-16 04:33 +0100
    Re: How the computer identify an NaN? fl <rxjwg98@gmail.com> - 2011-08-15 21:45 -0700
      Re: How the computer identify an NaN? Robert Wessel <robertwessel2@yahoo.com> - 2011-08-16 00:45 -0500
      Re: How the computer identify an NaN? "Heinrich Wolf" <invalid@invalid.invalid> - 2011-08-16 08:51 +0200
        Re: How the computer identify an NaN? bert <bert.hutchings@btinternet.com> - 2011-08-16 02:01 -0700
          Re: How the computer identify an NaN? "Heinrich Wolf" <invalid@invalid.invalid> - 2011-08-16 13:04 +0200
            Re: How the computer identify an NaN? jt@toerring.de (Jens Thoms Toerring) - 2011-08-16 11:28 +0000
              Re: How the computer identify an NaN? jt@toerring.de (Jens Thoms Toerring) - 2011-08-16 11:31 +0000
                Re: How the computer identify an NaN? "Heinrich Wolf" <invalid@invalid.invalid> - 2011-08-16 14:08 +0200
              Re: How the computer identify an NaN? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-08-16 13:37 +0100
                Re: How the computer identify an NaN? jt@toerring.de (Jens Thoms Toerring) - 2011-08-16 21:13 +0000
            Re: How the computer identify an NaN? "Heinrich Wolf" <invalid@invalid.invalid> - 2011-08-16 14:17 +0200
          Re: How the computer identify an NaN? "Heinrich Wolf" <invalid@invalid.invalid> - 2011-08-16 13:22 +0200
            Re: How the computer identify an NaN? Angel <angel+news@spamcop.net> - 2011-08-16 15:17 +0000
      Re: How the computer identify an NaN? James Kuyper <jameskuyper@verizon.net> - 2011-08-16 08:42 -0400
      Re: How the computer identify an NaN? Stephen Sprunk <stephen@sprunk.org> - 2011-08-16 09:25 -0500
      Re: How the computer identify an NaN? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-08-16 12:37 -0600
        Re: How the computer identify an NaN? Keith Thompson <kst-u@mib.org> - 2011-08-16 12:26 -0700

csiph-web