std::numeric_limits<T>::infinity
Min standard notice:
Returns the special value “positive infinity”, as represented by the floating-point type T. Only meaningful if std::numeric_limits
# Declarations
static T infinity() throw();
(until C++11)
static constexpr T infinity() noexcept;
(since C++11)
# Example
#include <iostream>
#include <limits>
int main()
{
double max = std::numeric_limits<double>::max();
double inf = std::numeric_limits<double>::infinity();
if (inf > max)
std::cout << inf << " is greater than " << max << '\n';
}