🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #11869

How can I test if NaN?

#11869
From: Jeffrey Mulligan
Date: Mon, 03 Apr 1989 22:19
18 lines
1406 bytes
Is there a way to test if a floating point variable is "NaN" or == "Inf" ?

I suppose that I could always cast to integer, strip the exponent and test
if the mantissa is in the legal range, but I am hoping for something more
machine independent.

(in case you're wondering why I care, we have an array processor which
thoughtfully gives NaN for atan2(0,0).  Granted, this quantity is
undefined, but a legitimate value (like 0) wouldn't wreak havoc with
normalization!  I begin normalizing by finding the min and max; I'd like
to be able to test if the min and max are NaN's!)

	Jeff Mulligan (jbm@aurora.arc.nasa.gov)
	NASA/Ames Research Ctr., Mail Stop 239-3, Moffet Field CA, 94035
	(415) 694-6290

[[ I hate to say "RTFM", but....  Please see ieee_functions(3M).  You will
find the functions "isinf" and "isnan" documented there.  --wnl ]]
Technical Details
Message-ID: <2917@eos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
References: <8903082132.AA05654@cs.columbia.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: jbm@eos.arc.nasa.gov (Jeffrey Mulligan)
Newsgroups: comp.sys.sun
Subject: How can I test if NaN?
Keywords: Software
Message-ID: <2917@eos.UUCP>
Date: 3 Apr 89 22:19:50 GMT
References: <8903082132.AA05654@cs.columbia.edu>
Sender: usenet@rice.edu
Organization: NASA Ames Research Center, California
Lines: 18
Approved: Sun-Spots@rice.edu
Original-Date: 16 Mar 89 03:49:44 GMT
X-Sun-Spots-Digest: Volume 7, Issue 220, message 14 of 16