On Sun, 10 Feb 2008, Jim Razmus wrote: > I'm told that math.h should do this for me. Moreover, I think NAN is a > machine dependent value.
See /usr/include/i386/ieee.h for some hints. > Adding the line you mention would break on VAX (assuming I understand > this correctly). Although I don't think anyone would run this program > on a VAX, if it's in the ports tree there's the possibility. Probably. Vaxes didn't use IEEE floating point. > Worst case, I could add those defines though. I'd do some more research. Examine the source code for "isnan()" This is the i386 version #include <sys/types.h> #include <machine/ieee.h> #include <math.h> int isnan(d) double d; { struct ieee_double *p = (struct ieee_double *)&d; return (p->dbl_exp == DBL_EXP_INFNAN && (p->dbl_frach != 0 || p->dbl_fracl != 0)); } We notice the || in the comparison. There is more than one NaN, in other words. DBL_EXP_INFNAN is defined in ieee.h So there is no unique "NaN". Dave -- The president of the United States is the commander-in-chief of the armed forces. He is not the commander-in-chief of the government, nor is he the commander-in-chief of the country.