I always thought there were 2 kinds of NaN's: quiet and signaling.
But then I realized the NAN
macro evaluates to neither.
In Visual C++, std::numeric_limits<float>::quiet_NaN()
is displayed as 1.#QNAN000
.
In Visual C++, std::numeric_limits<float>::signaling_NaN()
is displayed as 1.#QNAN000
.
Yet also in Visual C++, NAN
is displayed as -1.#IND0000
... which is neither of the above.
What kind of NaN, then, is the
NAN
constant? Is it signaling or nonsignaling?When should I use
NAN
instead of the others, when should I avoid it, and why?