Try to add
#include <math.h>
and then using the standard isnan() function for testing.
You can also use the "trick" that NaN is not equal to anyone, including yourself:
double x; // do some operation here x = doSomething(); if (x != x) printf("%g is probably NaN, it not equal to itself\n", x);
unwind Jan 21 '10 at 12:55 2010-01-21 12:55
source share