Überprüfen, ob float oder double NaN in C++ ist

English Deutsch

Das Überprüfen auf NaN ist einfach seit C++11:

isnan_example.cpp
#include <numeric>

bool isNaN = std::isnan(myNumber);

See the std::isnan docs for reference.

You can also use the C99 function isnan from <cmath>:

isnan_c_example.cpp
#include <cmath>

bool isNaN = isnan(myDouble);

Check out similar posts by category: C/C++