数据类型常量Data Type Constants

数据类型常量是实现相关的整数数据类型允许的值范围。Data type constants are implementation-dependent ranges of values allowed for integral data types. 下面列出的常数提供了整数数据类型的范围,并在 LIMITS.H 中进行了定义。The constants listed below give the ranges for the integral data types and are defined in LIMITS.H.

备注

/J 编译器选项将默认 char 类型更改为 unsignedThe /J compiler option changes the default char type to unsigned.

常量Constant Value 含义Meaning
SCHAR_MAXSCHAR_MAX 127127 最大带符号 charMaximum signed char value
SCHAR_MINSCHAR_MIN -128-128 最小带符号 charMinimum signed char value
UCHAR_MAXUCHAR_MAX 255 (0xff)255 (0xff) 最大 unsigned charMaximum unsigned char value
CHAR_BITCHAR_BIT 88 char 中的位数Number of bits in a char
USHRT_MAXUSHRT_MAX 65535 (0xffff)65535 (0xffff) 最大 unsigned shortMaximum unsigned short value
SHRT_MAXSHRT_MAX 3276732767 最大(带符号)shortMaximum (signed) short value
SHRT_MINSHRT_MIN -32768-32768 最小(带符号)shortMinimum (signed) short value
UINT_MAXUINT_MAX 4294967295 (0xffffffff)4294967295 (0xffffffff) 最大 unsigned intMaximum unsigned int value
ULONG_MAXULONG_MAX 4294967295 (0xffffffff)4294967295 (0xffffffff) 最大 unsigned longMaximum unsigned long value
INT_MAXINT_MAX 21474836472147483647 最大(带符号)intMaximum (signed) int value
INT_MININT_MIN -2147483647-1-2147483647-1 最小(带符号)intMinimum (signed) int value
LONG_MAXLONG_MAX 21474836472147483647 最大(带符号)longMaximum (signed) long value
LONG_MINLONG_MIN -2147483647-1-2147483647-1 最小(带符号)longMinimum (signed) long value
CHAR_MAXCHAR_MAX 127(如果使用了 /J 选项,则为 255)127 (255 if /J option used) 最大 charMaximum char value
CHAR_MINCHAR_MIN -128(如果使用了 /J 选项,则为 0)-128 (0 if /J option used) 最小 charMinimum char value
MB_LEN_MAXMB_LEN_MAX 22 多字节 char 中的最大字节数Maximum number of bytes in multibyte char
_I64_MAX_I64_MAX 92233720368547758079223372036854775807 最大(带符号)int64Maximum (signed) int64 value
_I64_MIN_I64_MIN -9223372036854775807-1-9223372036854775807-1 最小(带符号)int64Minimum (signed) int64 value
_UI64_MAX_UI64_MAX 0xffffffffffffffff0xffffffffffffffff 最大(无符号)int64Maximum (unsigned) int64 value

以下常数提供了 doublefloat 数据类型的范围和其他特性,并在 FLOAT.H 中进行了定义:The following constants give the range and other characteristics of the double and float data types, and are defined in FLOAT.H:

常量Constant Value 描述Description
DBL_DIGDBL_DIG 1515 精度的小数位数# of decimal digits of precision
DBL_EPSILONDBL_EPSILON 2.2204460492503131e-0162.2204460492503131e-016 最小:1.0+DBL_EPSILON !=1.0Smallest such that 1.0+DBL_EPSILON !=1.0
DBL_MANT_DIGDBL_MANT_DIG 5353 尾数中的位数# of bits in mantissa
DBL_MAXDBL_MAX 1.7976931348623158e+3081.7976931348623158e+308 最大值Maximum value
DBL_MAX_10_EXPDBL_MAX_10_EXP 308308 最大十进制指数Maximum decimal exponent
DBL_MAX_EXPDBL_MAX_EXP 10241024 最大二进制指数Maximum binary exponent
DBL_MINDBL_MIN 2.2250738585072014e-3082.2250738585072014e-308 最小正值Minimum positive value
DBL_MIN_10_EXPDBL_MIN_10_EXP (-307)(-307) 最小十进制指数Minimum decimal exponent
DBL_MIN_EXPDBL_MIN_EXP (-1021)(-1021) 最小二进制指数Minimum binary exponent
_DBL_RADIX_DBL_RADIX 22 指数基数Exponent radix
_DBL_ROUNDS_DBL_ROUNDS 11 加法四舍五入:接近Addition rounding: near
FLT_DIGFLT_DIG 66 十进制位数的精度Number of decimal digits of precision
FLT_EPSILONFLT_EPSILON 1.192092896e-07F1.192092896e-07F 最小:1.0+FLT_EPSILON !=1.0Smallest such that 1.0+FLT_EPSILON !=1.0
FLT_MANT_DIGFLT_MANT_DIG 2424 尾数中的位数Number of bits in mantissa
FLT_MAXFLT_MAX 3.402823466e+38F3.402823466e+38F 最大值Maximum value
FLT_MAX_10_EXPFLT_MAX_10_EXP 3838 最大十进制指数Maximum decimal exponent
FLT_MAX_EXPFLT_MAX_EXP 128128 最大二进制指数Maximum binary exponent
FLT_MINFLT_MIN 1.175494351e-38F1.175494351e-38F 最小正值Minimum positive value
FLT_MIN_10_EXPFLT_MIN_10_EXP (-37)(-37) 最小十进制指数Minimum decimal exponent
FLT_MIN_EXPFLT_MIN_EXP (-125)(-125) 最小二进制指数Minimum binary exponent
FLT_RADIXFLT_RADIX 22 指数基数Exponent radix
FLT_ROUNDSFLT_ROUNDS 11 加法四舍五入:接近Addition rounding: near

另请参阅See Also

全局常量Global Constants