Is this possible to assign a NaN to a double or float in C/C++? Like in JavaScript you do: a = NaN. So later you can chec
NaN
double
float
a = NaN
In C, NAN is declared in .
NAN
In C++, std::numeric_limits::quiet_NaN() is declared in .
std::numeric_limits::quiet_NaN()
But for checking whether a value is NaN, you can't compare it with another NaN value. Instead use isnan() from in C, or std::isnan() from in C++.
isnan()
std::isnan()