在线文档教程
C++
应用 | Utilities

std::numeric_limits::digits

STD::数字[医]限制::数字

static const int digits;(until C++11)
static constexpr int digits;(since C++11)

价值std::numeric_limits<T>::digits是基数中的数字-根可以由类型表示的T没有改变。对于整数类型,这是不包括符号位的位数和填充位数%28(如果有%29)。对于浮点类型,这是尾数中的数字数.

标准专业化

Tvalue of std::numeric_limits::digits (assuming no padding bits)
/* non-specialized */​0​
bool1
charCHAR_BIT - std::numeric_limits<char>::is_signed
signed charCHAR_BIT-1
unsigned charCHAR_BIT
wchar_tCHAR_BIT*sizeof(wchar_t) - std::numeric_limits<wchar_t>::is_signed
char16_tCHAR_BIT*sizeof(char16_t)
char32_tCHAR_BIT*sizeof(char32_t)
shortCHAR_BIT*sizeof(short)-1
unsigned shortCHAR_BIT*sizeof(short)
intCHAR_BIT*sizeof(int)-1
unsigned intCHAR_BIT*sizeof(int)
longCHAR_BIT*sizeof(long)-1
unsigned longCHAR_BIT*sizeof(long)
long longCHAR_BIT*sizeof(long long)-1
unsigned long longCHAR_BIT*sizeof(long long)
floatFLT_MANT_DIG
doubleDBL_MANT_DIG
long doubleLDBL_MANT_DIG

另见

radix staticthe radix or integer base used by the representation of the given type (public static member constant)
min_exponent staticone more than the smallest negative power of the radix that is a valid normalized floating-point value (public static member constant)
max_exponent staticone more than the largest integer power of the radix that is a valid finite floating-point value (public static member constant)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/type/NUMERIC[医]限制/数字