std::numeric_limits<T>::max_exponent
cppreference.net에서 발췌
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
참고 항목
|
[static]
|
유효한 정규화된 부동 소수점 값인 10의 가장 작은 음의 거듭제곱
(public static member constant) |
|
[static]
|
유효한 정규화된 부동 소수점 값인 기수의 가장 작은 음의 거듭제곱보다 1 큰 값
(public static member constant) |
|
[static]
|
유효한 유한 부동 소수점 값인 10의 가장 큰 정수 거듭제곱
(public static member constant) |