Search code examples
g++

Could someone explain what does "-1.#QNAN" mean?


The "-1.#QNAN" symbol appears when I use g++ to compile the following syntax, just simply get the max value long double in the c++ standard library: cout << "max(long double): " << numeric_limits<long double>::max() << endl; could someone help me explain what does that symbol mean?


Solution

  • NaN (Not a Number) is a value of the numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations.

    Two separate kinds of NaNs are provided, termed quiet NaNs and signaling NaNs.

    Quiet NaNs are used to propagate errors resulting from invalid operations or values, whereas signaling NaNs can support advanced features such as mixing numerical and symbolic computation or other extensions to basic floating-point arithmetic.

    Reference:
    Wikipedia