🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1894

Re: trapping NaN

#1894
From: Frank Mitchell
Date: Mon, 23 Nov 1992 16:12
25 lines
1146 bytes
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
Technical Details
Message-ID: <1992Nov23.161217.23247@fnbc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!juliet!news
References: <1992Nov21.111335.4014@arizona.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!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