how to check if an integer is nan in c++ code example Example: C++ is nan doubel a = 0 ; bool isnan_a = std::isnan(a) || std::isnan(-a);