Topic: What is this "nan0x7fffffff" ? How is it created?


Author: joshua@oncomdis.on.ca (joshua)
Date: 1995/04/09
Raw View
Lixin Pang (pang@cvdev.rochester.edu) wrote:
: A number divided by zero gives infinity.  I am running a numerical

In number theory yes.  In computer theory No.  You have to guard
against division by zero.  (At least in any program I've
written).

-- Joshua Allen





Author: davisonj@en.ecn.purdue.edu (John M Davison)
Date: 1995/04/08
Raw View
        In article <3lq6rn$qk6@bilbo.ceas.rochester.edu>
pang@cvdev.rochester.edu (Lixin Pang) writes:
>A number divided by zero gives infinity.

        No, it does not.  (Show me the book that told you it did.)
--
John Davison
Electronic Mail: davisonj@ecn.purdue.edu
WWW Home Page: <http://en.ecn.purdue.edu:20002/~davisonj/HomePage.html>





Author: pang@cvdev.rochester.edu (Lixin Pang)
Date: 1995/04/04
Raw View
A number divided by zero gives infinity.  I am running a numerical
code in c++ that sometimes gives me stuff like "nan0x7fffffff" and
"nan0x10000000".  How are they created?  How to avoid them?

I need  something like:

if ( a == nan0x7fffffff )
  exit (EXIT_FAILURE);

Is it possible?  C++ experts please help!  Thanks.