You can use the isnan()
function, but you need to include the C math library.
#include <cmath>
As this function is part of C99, it is not available everywhere. If your vendor does not supply the function, you can also define your own variant for compatibility.
inline bool isnan(double x) {
return x != x;
}