std::numeric_limits<T>::min_exponent10

来自cppreference.com
 
 
 
 
 
static const int min_exponent10;
(C++11 前)
static constexpr int min_exponent10;
(C++11 起)

std::numeric_limits<T>::min_exponent10 的值是满足 10n
是浮点数类型 T 的合法正规值的最低负数 n

标准特化

Tstd::numeric_limits<T>::min_exponent10 的值
/* 未特化 */0
bool0
char0
signed char0
unsigned char0
wchar_t0
char8_t (C++20 起)0
char16_t (C++11 起)0
char32_t (C++11 起)0
short0
unsigned short0
int0
unsigned int0
long0
unsigned long0
long long (C++11 起)0
unsigned long long (C++11 起)0
floatFLT_MIN_10_EXP
doubleDBL_MIN_10_EXP
long doubleLDBL_MIN_10_EXP

示例

演示对于 float 类型的 min_exponentmin_exponent10min()radix 的关系:

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

输出:

min() = 1.17549e-38
min_exponent10 = -37
 
min() = 0x1p-126
min_exponent = -125

参阅

底的该数次幂是合法正规浮点数的最小负数加一
(公开静态成员常量)
底的该数次幂是合法有限浮点数的最大整数加一
(公开静态成员常量)
10 的该数次幂是合法有限浮点数的最大整数
(公开静态成员常量)