home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!psinntp!juliet!news
- From: frank@fnbc.com (Frank Mitchell)
- Subject: Re: trapping NaN
- Message-ID: <1992Nov23.161217.23247@fnbc.com>
- Sender: news@fnbc.com
- Organization: First National Bank Of Chicago, Chicago IL, USA
- References: <1992Nov21.111335.4014@arizona.edu>
- Distribution: world,local
- Date: Mon, 23 Nov 92 16:12:17 GMT
- Lines: 25
-
- In article <1992Nov21.111335.4014@arizona.edu> writes:
- > In article <1992Nov20.221038.1170@proforma.com> writes:
- > > I would like to trap NaN -- the "not a number" condition that floating
- point
- > > values can take.
- > It turns out that (NaN != NaN) is true. So, in some code I did before, I
- used:
- >
- > if(x == x) { /* x is NOT NaN */
- > < use x>
- > }
- > else {
- > <whatever for the NaN case>
- > }
- >
-
- I tend to use the finite() call, which also traps infinities (which may
- be good or bad). Check out its man page for details.
-
- --
- Frank Mitchell, Business Systems Analyst, First National Bank of Chicago
- email:frank@fnbc.com (NeXTmail)
-
- A happy child is merely an unhappy child who is having fun.
- -- Morticia Addams
-