std::numeric_limits<T>::max_exponent

The value of std::numeric_limits::max_exponent is the largest positive number n such that (\scriptsize r^{n-1})rn-1, where r is std::numeric_limits::radix, is a representable finite value of the floating-point type T.

# Declarations

static const int max_exponent;

(until C++11)

static constexpr int max_exponent;

(since C++11)

# Example

#include <iostream>
#include <limits>
 
int main()
{
    std::cout << "max() = " << std::numeric_limits<float>::max() << '\n'
              << "max_exponent10 = " << std::numeric_limits<float>::max_exponent10 << '\n'
              << std::hexfloat << '\n'
              << "max() = " << std::numeric_limits<float>::max() << '\n'
              << "max_exponent = " << std::numeric_limits<float>::max_exponent << '\n';
}

# See also