Namespaces
Variants

std::numeric_limits<T>::max_exponent

cppreference.net에서 발췌
 
 
유틸리티 라이브러리
일반 유틸리티
관계 연산자 (C++20에서 비권장됨)
정수 비교 함수
(C++20)(C++20)(C++20)    
(C++20)
Swap 및 타입 연산
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
공통 어휘 타입
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
 
static const int max_exponent;
(C++11까지)
static constexpr int max_exponent;
(C++11부터)

std::numeric_limits<T>::max_exponent의 값은 n \(\scriptsize r^{n-1}\)의 표현 가능한 유한 값이 되도록 하는 가장 큰 양수 입니다. 여기서
는 r이고, std::numeric_limits<T>::radix입니다. T

표준 특수화

T std:: numeric_limits < T > :: max_exponent 의 값
/* non-specialized */ ​ 0 ​
bool ​ 0 ​
char ​ 0 ​
signed char ​ 0 ​
unsigned char ​ 0 ​
wchar_t ​ 0 ​
char8_t (C++20부터) ​ 0 ​
char16_t (C++11부터) ​ 0 ​
char32_t (C++11부터) ​ 0 ​
short ​ 0 ​
unsigned short ​ 0 ​
int ​ 0 ​
unsigned int ​ 0 ​
long ​ 0 ​
unsigned long ​ 0 ​
long long (C++11부터) ​ 0 ​
unsigned long long (C++11부터) ​ 0 ​
float FLT_MAX_EXP
double DBL_MAX_EXP
long double LDBL_MAX_EXP

예제

float 타입에 대한 max_exponent , max_exponent10 , 그리고 max() 의 관계를 보여줍니다:

#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';
}

출력:

max() = 3.40282e+38
max_exponent10 = 38
max() = 0x1.fffffep+127
max_exponent = 128

참고 항목

유효한 정규화된 부동 소수점 값인 10의 가장 작은 음의 거듭제곱
(public static member constant)
유효한 정규화된 부동 소수점 값인 기수의 가장 작은 음의 거듭제곱보다 1 큰 값
(public static member constant)
유효한 유한 부동 소수점 값인 10의 가장 큰 정수 거듭제곱
(public static member constant)