I would like to use NaN's. It appears that isnan() works as advertised so I can check for NaN. However, there is a man page for infnan() but no such function appears to be available. Does anyone know the proper way to generate a NaN value? (I am using NaN as an initialization value so that I can check that a valid value is used later.) For the moment I am using NAN as defined in nan.h but it requires the use of "#define _GNU_SOURCE 1". I would like to keep the code somewhat portable.
/* HUGE_VAL is traditionally defined as positive infinity, or alternatively, DBL_MAX. */ #if !HAVE_ISINF #define isinf(X) \ (fabs (X) == HUGE_VAL) #endif /* A Not a Number is not equal to itself. */ #if !HAVE_ISNAN #define isnan(X) \ ((X) != (X)) #endif /* Finite numbers are not infinities or NaNs. */ #if !HAVE_FINITE #define finite(X) \ (!isinf (X) && !isnan (X)) #elif HAVE_IEEEFP_H #include <ieeefp.h> /* Declares finite() under Solaris. */ #endif The definition of infnan() is left as an exercise to the reader :-) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]