Export (0) Print
Expand All

numeric_limits::has_infinity

Tests whether a type has a representation for positive infinity.

static const bool has_infinity = false;

true if the type has a representation for positive infinity; false if not.

The member returns true if is_iec559 is true.

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

using namespace std;

int main( )
{
   cout << "Whether float objects have infinity: "
        << numeric_limits<float>::has_infinity
        << endl;
   cout << "Whether double objects have infinity: "
        << numeric_limits<double>::has_infinity
        << endl;
   cout << "Whether long int objects have infinity: " 
        << numeric_limits<long int>::has_infinity
        << endl;
}
Whether float objects have infinity: 1
Whether double objects have infinity: 1
Whether long int objects have infinity: 0

Header: <limits>

Namespace: std

Show:
© 2014 Microsoft