共用方式為


numeric_limits::max_exponent

Returns the maximum positive integral exponent that the floating-point type can represent as a finite value when a base of radix is raised to that power.

static const int max_exponent = 0;

Return Value

The maximum integral radix-based exponent representable by the type.

Remarks

The member function return is meaningful only for floating-point types. The max_exponent is the value FLT_MAX_EXP for type float.

Example

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

using namespace std;

int main( )
{
   cout << "The maximum radix-based exponent for type float is:  "
        << numeric_limits<float>::max_exponent
        << endl;
   cout << "The maximum radix-based exponent for type double is:  "
        << numeric_limits<double>::max_exponent
        << endl;
   cout << "The maximum radix-based exponent for type long double is:  "
        << numeric_limits<long double>::max_exponent
        << endl;
}
The maximum radix-based exponent for type float is:  128
The maximum radix-based exponent for type double is:  1024
The maximum radix-based exponent for type long double is:  1024

Requirements

Header: <limits>

Namespace: std

See Also

Reference

strstreambuf Class