how to find out if a whole number variable is NaN C++ code example Example: C++ is nan doubel a = 0 ; bool isnan_a = std::isnan(a) || std::isnan(-a);