Export (0) Print
Expand All

numeric_limits::signaling_NaN

Returns the representation of a signaling not a number (NAN) for the type.

static Type signaling_NaN( ) throw( );

The representation of a signaling NAN for the type.

The return value is meaningful only if has_signaling_NaN is true.

// numeric_limits_signaling_nan.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>

using namespace std;

int main( )
{
   cout << "The signaling NaN for type float is:  "
        << numeric_limits<float>::signaling_NaN( )
        << endl;
   cout << "The signaling NaN for type int is:  "
        << numeric_limits<int>::signaling_NaN( )
        << endl;
   cout << "The signaling NaN for type long double is:  "
        << numeric_limits<long double>::signaling_NaN( )
        << endl;
}

The following is output on x86.

The signaling NaN for type float is:  1.#QNAN
The signaling NaN for type int is:  0
The signaling NaN for type long double is:  1.#QNAN

Header: <limits>

Namespace: std

Show:
© 2014 Microsoft