std::numeric_limits::digits

static const int digits;
(C++11 前)
static constexpr int digits;
(C++11 起)

std::numeric_limits<T>::digits 的值是能无更改地表示类型 Tradix 底位数。对于整数类型,这是不含符号位和填充位(若存在)的位数。对于浮点类型,这是尾数的位数。

标准特化

T std::numeric_limits<T>::digits 的值(假设无填充位)
/* non-specialized */ 0
bool 1
char CHAR_BIT - std::numeric_limits<char>::is_signed
signed char CHAR_BIT-1
unsigned char CHAR_BIT
wchar_t CHAR_BIT*sizeof(wchar_t) - std::numeric_limits<wchar_t>::is_signed
char16_t CHAR_BIT*sizeof(char16_t)
char32_t CHAR_BIT*sizeof(char32_t)
short CHAR_BIT*sizeof(short)-1
unsigned short CHAR_BIT*sizeof(short)
int CHAR_BIT*sizeof(int)-1
unsigned int CHAR_BIT*sizeof(int)
long CHAR_BIT*sizeof(long)-1
unsigned long CHAR_BIT*sizeof(long)
long long CHAR_BIT*sizeof(long long)-1
unsigned long long CHAR_BIT*sizeof(long long)
float FLT_MANT_DIG
double DBL_MANT_DIG
long double LDBL_MANT_DIG

参阅

[静态]
给定类型的表示所用的基或整数底
(公开静态成员常量)
[静态]
底的该数次幂是合法正规浮点值的最小负数加一
(公开静态成员常量)
[静态]
底的该数次幂是合法有限浮点值的最大整数加一
(公开静态成员常量)

版本历史

  • (当前 | 先前 2017年7月7日 (五) 22:59Fruderica讨论 | 贡献. . (2,121字节) (-573). . (撤销)
  • 当前 | 先前 2013年7月2日 (二) 11:43P12bot讨论 | 贡献 . . (2,694字节) (-318). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 15:35P12bot讨论 | 贡献 . . (3,012字节) (+313). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 11:50P12讨论 | 贡献 . . (2,699字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (2,699字节) (-22). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 03:34P12讨论 | 贡献 . . (2,721字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (2,721字节) (+2,721). . (Translated from the English version using Google Translate)