www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/23/03:37:45

Message-Id: <9804230735.AA23669@axe.bre.da>
Subject: Re: Spotting NaNs
To: pderbysh AT usa DOT net (Paul Derbyshire)
Date: Thu, 23 Apr 1998 9:35:50 METDST
Cc: djgpp AT delorie DOT com
In-Reply-To: <353EDEE5.2797D62E@usa.net>; from "Paul Derbyshire" at Apr 23, 98 6:29 am
From: Jens Bischoff <j DOT bischoff AT airbus DOT dasa DOT de>

Hello!

> 
> Is there an ANSI/POSIX function for testing if a float or a double is a NaN?
> 
>

I'm not sure if this will work with djgpp (since I haven't a PC with DJGPP
in front of me), but you should try the following functions

	int isnan (double x);
	int isnanf (float x);

Both return a nonzero integer if x is NaN, otherwise they return 0.

Don't forget to link in the math library (-lm).


Jens
--
|      |      | Jens Bischoff   |   Daimler-Benz Aerospace Airbus |
|   --<O>--   +-----------------+---------------------------------+
|      |      | Aerodynamic Data Department (EFD)                 |
| Dasa Airbus | Huenefeldstrasse 1-5     D-28199 Bremen (Germany) |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019