|
1 | 1 | ---
|
2 | 2 | title: "Data Type Constants | Microsoft Docs"
|
3 | 3 | ms.custom: ""
|
4 |
| -ms.date: "11/04/2016" |
| 4 | +ms.date: "06/25/2018" |
5 | 5 | ms.technology: ["cpp-standard-libraries"]
|
6 | 6 | ms.topic: "conceptual"
|
7 |
| -f1_keywords: ["FLT_MIN", "SHRT_MAX", "CHAR_MIN", "MB_LEN_MAX", "DBL_EPSILON", "SHRT_MIN", "_FLT_RADIX", "FLT_DIG", "FLT_MAX_10_EXP", "FLT_MANT_DIG", "DBL_MAX_EXP", "SCHAR_MIN", "SCHAR_MAX", "DBL_MIN", "FLT_MIN_10_EXP", "_DBL_ROUNDS", "USHRT_MAX", "FLT_MAX_EXP", "LONG_MAX", "DBL_MAX", "DBL_DIG", "FLT_MIN_EXP", "INT_MIN", "DBL_MIN_10_EXP", "CHAR_BIT", "INT_MAX", "ULONG_MAX", "DBL_MIN_EXP", "LONG_MIN", "_FLT_ROUNDS", "DBL_MANT_DIG", "_DBL_RADIX", "CHAR_MAX", "FLT_MAX", "DBL_MAX_10_EXP", "UCHAR_MAX", "FLT_EPSILON", "UINT_MAX"] |
| 7 | +f1_keywords: ["FLT_MIN", "SHRT_MAX", "CHAR_MIN", "MB_LEN_MAX", "DBL_EPSILON", "SHRT_MIN", "_FLT_RADIX", "FLT_DIG", "FLT_MAX_10_EXP", "FLT_MANT_DIG", "DBL_MAX_EXP", "SCHAR_MIN", "SCHAR_MAX", "DBL_MIN", "FLT_MIN_10_EXP", "_DBL_ROUNDS", "USHRT_MAX", "FLT_MAX_EXP", "LONG_MAX", "DBL_MAX", "DBL_DIG", "FLT_MIN_EXP", "INT_MIN", "DBL_MIN_10_EXP", "CHAR_BIT", "INT_MAX", "ULONG_MAX", "DBL_MIN_EXP", "LONG_MIN", "_FLT_ROUNDS", "DBL_MANT_DIG", "_DBL_RADIX", "CHAR_MAX", "FLT_MAX", "DBL_MAX_10_EXP", "UCHAR_MAX", "FLT_EPSILON", "UINT_MAX", "LLONG_MIN", "LLONG_MAX", "ULLONG_MAX", "_I8_MIN", "_I8_MAX", "_UI8_MAX", "_I16_MIN", "_I16_MAX", "_UI16_MAX", "_I32_MIN", "_I32_MAX", "_UI32_MAX", "_I64_MIN", "_I64_MAX", "_UI64_MAX", "_I128_MIN", "_I128_MAX", "_UI128_MAX", "SIZE_MAX", "RSIZE_MAX", "LDBL_DIG", "LDBL_EPSILON", "LDBL_HAS_SUBNORM", "LDBL_MANT_DIG", "LDBL_MAX", "LDBL_MAX_10_EXP", "LDBL_MAX_EXP", "LDBL_MIN", "LDBL_MIN_10_EXP", "LDBL_MIN_EXP", "_LDBL_RADIX", "LDBL_TRUE_MIN", "DECIMAL_DIG"] |
8 | 8 | dev_langs: ["C++"]
|
9 |
| -helpviewer_keywords: ["DBL_MAX_EXP constant", "_DBL_RADIX constant", "FLT_MIN_EXP constant", "DBL_EPSILON constant", "INT_MIN constant", "FLT_EPSILON constant", "DBL_MANT_DIG constant", "_FLT_RADIX constant", "DBL_MIN constant", "USHRT_MAX constant", "FLT_MAX_10_EXP constant", "_FLT_ROUNDS constant", "data type constants [C++]", "_DBL_ROUNDS constant", "CHAR_MAX constant", "FLT_MAX_EXP constant", "FLT_MIN constant", "CHAR_MIN constant", "FLT_MIN_10_EXP constant", "DBL_MIN_EXP constant", "SCHAR_MAX constant", "FLT_RADIX constant", "CHAR_BIT constant", "UCHAR_MAX constant", "DBL_RADIX constant", "FLT_ROUNDS constant", "LONG_MIN constant", "SHRT_MAX constant", "LONG_MAX constant", "DBL_MAX_10_EXP constant", "DBL_MIN_10_EXP constant", "INT_MAX constant", "constants [C++], data type", "ULONG_MAX constant", "FLT_DIG constant", "MB_LEN_MAX constant", "DBL_DIG constant", "SHRT_MIN constant", "DBL_MAX constant", "DBL_ROUNDS constant", "FLT_MAX constant", "UINT_MAX constant", "FLT_MANT_DIG constant", "SCHAR_MIN constant"] |
| 9 | +helpviewer_keywords: ["DBL_MAX_EXP constant", "_DBL_RADIX constant", "FLT_MIN_EXP constant", "DBL_EPSILON constant", "INT_MIN constant", "FLT_EPSILON constant", "DBL_MANT_DIG constant", "_FLT_RADIX constant", "DBL_MIN constant", "USHRT_MAX constant", "FLT_MAX_10_EXP constant", "_FLT_ROUNDS constant", "data type constants [C++]", "_DBL_ROUNDS constant", "CHAR_MAX constant", "FLT_MAX_EXP constant", "FLT_MIN constant", "CHAR_MIN constant", "FLT_MIN_10_EXP constant", "DBL_MIN_EXP constant", "SCHAR_MAX constant", "FLT_RADIX constant", "CHAR_BIT constant", "UCHAR_MAX constant", "DBL_RADIX constant", "FLT_ROUNDS constant", "LONG_MIN constant", "SHRT_MAX constant", "LONG_MAX constant", "DBL_MAX_10_EXP constant", "DBL_MIN_10_EXP constant", "INT_MAX constant", "constants [C++], data type", "ULONG_MAX constant", "FLT_DIG constant", "MB_LEN_MAX constant", "DBL_DIG constant", "SHRT_MIN constant", "DBL_MAX constant", "DBL_ROUNDS constant", "FLT_MAX constant", "UINT_MAX constant", "FLT_MANT_DIG constant", "SCHAR_MIN constant", "LLONG_MIN constant", "LLONG_MAX constant", "ULLONG_MAX constant", "_I8_MIN constant", "_I8_MAX constant", "_UI8_MAX constant", "_I16_MIN constant", "_I16_MAX constant", "_UI16_MAX constant", "_I32_MIN constant", "_I32_MAX constant", "_UI32_MAX constant", "_I64_MIN constant", "_I64_MAX constant", "_UI64_MAX constant", "_I128_MIN constant", "_I128_MAX constant", "_UI128_MAX constant", "SIZE_MAX constant", "RSIZE_MAX constant"] |
10 | 10 | ms.assetid: c0f1c405-0465-41d5-b5ff-e81cdb6f1622
|
11 | 11 | author: "corob-msft"
|
12 | 12 | ms.author: "corob"
|
13 | 13 | ms.workload: ["cplusplus"]
|
14 | 14 | ---
|
15 | 15 | # Data Type Constants
|
16 |
| -Data type constants are implementation-dependent ranges of values allowed for integral data types. The constants listed below give the ranges for the integral data types and are defined in LIMITS.H. |
17 |
| - |
| 16 | + |
| 17 | +Data type constants are implementation-dependent ranges of values allowed for integral and floating-point data types. |
| 18 | + |
| 19 | +## Integral type constants |
| 20 | + |
| 21 | +These constants give the ranges for the integral data types. To use these constants, include the limits.h header in your source file: |
| 22 | + |
| 23 | +```C |
| 24 | +#include <limits.h> |
| 25 | +``` |
| 26 | + |
18 | 27 | > [!NOTE]
|
19 |
| -> The /J compiler option changes the default `char` type to `unsigned`. |
20 |
| - |
21 |
| -|Constant|Value|Meaning| |
22 |
| -|--------------|-----------|-------------| |
23 |
| -|**SCHAR_MAX**|127|Maximum signed `char` value| |
24 |
| -|**SCHAR_MIN**|-128|Minimum signed `char` value| |
25 |
| -|**UCHAR_MAX**|255 (0xff)|Maximum `unsigned char` value| |
26 |
| -|**CHAR_BIT**|8|Number of bits in a `char`| |
27 |
| -|**USHRT_MAX**|65535 (0xffff)|Maximum **unsigned short** value| |
28 |
| -|**SHRT_MAX**|32767|Maximum (signed) **short** value| |
29 |
| -|**SHRT_MIN**|-32768|Minimum (signed) **short** value| |
30 |
| -|**UINT_MAX**|4294967295 (0xffffffff)|Maximum `unsigned int` value| |
31 |
| -|**ULONG_MAX**|4294967295 (0xffffffff)|Maximum `unsigned long` value| |
32 |
| -|**INT_MAX**|2147483647|Maximum (signed) `int` value| |
33 |
| -|**INT_MIN**|-2147483647-1|Minimum (signed) `int` value| |
34 |
| -|**LONG_MAX**|2147483647|Maximum (signed) **long** value| |
35 |
| -|**LONG_MIN**|-2147483647-1|Minimum (signed) **long** value| |
36 |
| -|**CHAR_MAX**|127 (255 if /J option used)|Maximum `char` value| |
37 |
| -|**CHAR_MIN**|-128 (0 if /J option used)|Minimum `char` value| |
38 |
| -|**MB_LEN_MAX**|2|Maximum number of bytes in multibyte `char`| |
39 |
| -|**_I64_MAX**|9223372036854775807|Maximum (signed) __**int64** value| |
40 |
| -|**_I64_MIN**|-9223372036854775807-1|Minimum (signed) __**int64** value| |
41 |
| -|**_UI64_MAX**|0xffffffffffffffff|Maximum (unsigned) __**int64** value| |
42 |
| - |
43 |
| - The following constants give the range and other characteristics of the **double** and **float** data types, and are defined in FLOAT.H: |
44 |
| - |
45 |
| -|Constant|Value|Description| |
46 |
| -|--------------|-----------|-----------------| |
47 |
| -|**DBL_DIG**|15|# of decimal digits of precision| |
48 |
| -|**DBL_EPSILON**|2.2204460492503131e-016|Smallest such that 1.0+**DBL_EPSILON** !=1.0| |
49 |
| -|**DBL_MANT_DIG**|53|# of bits in mantissa| |
50 |
| -|**DBL_MAX**|1.7976931348623158e+308|Maximum value| |
51 |
| -|**DBL_MAX_10_EXP**|308|Maximum decimal exponent| |
52 |
| -|**DBL_MAX_EXP**|1024|Maximum binary exponent| |
53 |
| -|**DBL_MIN**|2.2250738585072014e-308|Minimum positive value| |
54 |
| -|**DBL_MIN_10_EXP**|(-307)|Minimum decimal exponent| |
55 |
| -|**DBL_MIN_EXP**|(-1021)|Minimum binary exponent| |
56 |
| -|**_DBL_RADIX**|2|Exponent radix| |
57 |
| -|**_DBL_ROUNDS**|1|Addition rounding: near| |
58 |
| -|**FLT_DIG**|6|Number of decimal digits of precision| |
59 |
| -|**FLT_EPSILON**|1.192092896e-07F|Smallest such that 1.0+**FLT_EPSILON** !=1.0| |
60 |
| -|**FLT_MANT_DIG**|24|Number of bits in mantissa| |
61 |
| -|**FLT_MAX**|3.402823466e+38F|Maximum value| |
62 |
| -|**FLT_MAX_10_EXP**|38|Maximum decimal exponent| |
63 |
| -|**FLT_MAX_EXP**|128|Maximum binary exponent| |
64 |
| -|**FLT_MIN**|1.175494351e-38F|Minimum positive value| |
65 |
| -|**FLT_MIN_10_EXP**|(-37)|Minimum decimal exponent| |
66 |
| -|**FLT_MIN_EXP**|(-125)|Minimum binary exponent| |
67 |
| -|**FLT_RADIX**|2|Exponent radix| |
68 |
| -|**FLT_ROUNDS**|1|Addition rounding: near| |
69 |
| - |
70 |
| -## See Also |
71 |
| - [Global Constants](../c-runtime-library/global-constants.md) |
| 28 | +> The [/J](../build/reference/j-default-char-type-is-unsigned.md) compiler option changes the default **char** type to **unsigned**. |
| 29 | +
|
| 30 | +|Constant|Value|Description| |
| 31 | +|--------------|-----------|-------------| |
| 32 | +|**CHAR_BIT**|8|Number of bits in a **char**| |
| 33 | +|**SCHAR_MIN**|(-128)|Minimum signed **char** value| |
| 34 | +|**SCHAR_MAX**|127|Maximum signed **char** value| |
| 35 | +|**UCHAR_MAX**|255 (0xff)|Maximum **unsigned** **char** value| |
| 36 | +|**CHAR_MIN**|(-128) (0 if **/J** option used)|Minimum **char** value| |
| 37 | +|**CHAR_MAX**|127 (255 if **/J** option used)|Maximum **char** value| |
| 38 | +|**MB_LEN_MAX**|5|Maximum number of bytes in multibyte **char**| |
| 39 | +|**SHRT_MIN**|-32768|Minimum signed **short** value| |
| 40 | +|**SHRT_MAX**|32767|Maximum signed **short** value| |
| 41 | +|**USHRT_MAX**|65535 (0xffff)|Maximum **unsigned** **short** value| |
| 42 | +|**INT_MIN**|(-2147483647 - 1)|Minimum signed **int** value| |
| 43 | +|**INT_MAX**|2147483647|Maximum signed **int** value| |
| 44 | +|**UINT_MAX**|4294967295 (0xffffffff)|Maximum **unsigned** **int** value| |
| 45 | +|**LONG_MIN**|(-2147483647L - 1)|Minimum signed **long** value| |
| 46 | +|**LONG_MAX**|2147483647L|Maximum signed **long** value| |
| 47 | +|**ULONG_MAX**|4294967295UL (0xfffffffful)|Maximum **unsigned** **long** value| |
| 48 | +|**LLONG_MIN**|(-9223372036854775807LL - 1)|Minimum signed **long** **long** or **__int64** value| |
| 49 | +|**LLONG_MAX**|9223372036854775807LL|Maximum signed **long** **long** or **__int64** value| |
| 50 | +|**ULLONG_MAX**|0xffffffffffffffffull|Maximum **unsigned** **long** **long** value| |
| 51 | +|**_I8_MIN**|(-127i8 - 1)|Minimum signed 8-bit value| |
| 52 | +|**_I8_MAX**|127i8|Maximum signed 8-bit value| |
| 53 | +|**_UI8_MAX**|0xffui8|Maximum unsigned 8-bit value| |
| 54 | +|**_I16_MIN**|(-32767i16 - 1)|Minimum signed 16-bit value| |
| 55 | +|**_I16_MAX**|32767i16|Maximum signed 16-bit value| |
| 56 | +|**_UI16_MAX**|0xffffui16|Maximum unsigned 16-bit value| |
| 57 | +|**_I32_MIN**|(-2147483647i32 - 1)|Minimum signed 32-bit value| |
| 58 | +|**_I32_MAX**|2147483647i32|Maximum signed 32-bit value| |
| 59 | +|**_UI32_MAX**|0xffffffffui32|Maximum unsigned 32-bit value| |
| 60 | +|**_I64_MIN**|(-9223372036854775807 - 1)|Minimum signed 64-bit value| |
| 61 | +|**_I64_MAX**|9223372036854775807|Maximum signed 64-bit value| |
| 62 | +|**_UI64_MAX**|0xffffffffffffffffui64|Maximum unsigned 64-bit value| |
| 63 | +|**_I128_MIN**|(-170141183460469231731687303715884105727i128 - 1)|Minimum signed 128-bit value| |
| 64 | +|**_I128_MAX**|170141183460469231731687303715884105727i128|Maximum signed 128-bit value| |
| 65 | +|**_UI128_MAX**|0xffffffffffffffffffffffffffffffffui128|Maximum unsigned 128-bit value| |
| 66 | +|**SIZE_MAX**|same as **_UI64_MAX** if **_WIN64** is defined, or **UINT_MAX**|Maximum native integer size| |
| 67 | +|**RSIZE_MAX**|same as (**SIZE_MAX** >> 1)|Maximum secure library integer size| |
| 68 | + |
| 69 | +## Floating-point type constants |
| 70 | + |
| 71 | +The following constants give the range and other characteristics of the **long** **double**, **double** and **float** data types. To use these constants, include the float.h header in your source file: |
| 72 | + |
| 73 | +```C |
| 74 | +#include <float.h> |
| 75 | +``` |
| 76 | + |
| 77 | +|Constant|Value|Description| |
| 78 | +|--------------|-----------|-----------------| |
| 79 | +|**DBL_DECIMAL_DIG**|17|# of decimal digits of rounding precision| |
| 80 | +|**DBL_DIG**|15|# of decimal digits of precision| |
| 81 | +|**DBL_EPSILON**|2.2204460492503131e-016|Smallest such that 1.0 + **DBL_EPSILON** != 1.0| |
| 82 | +|**DBL_HAS_SUBNORM**|1|Type supports subnormal (denormal) numbers| |
| 83 | +|**DBL_MANT_DIG**|53|# of bits in significand (mantissa)| |
| 84 | +|**DBL_MAX**|1.7976931348623158e+308|Maximum value| |
| 85 | +|**DBL_MAX_10_EXP**|308|Maximum decimal exponent| |
| 86 | +|**DBL_MAX_EXP**|1024|Maximum binary exponent| |
| 87 | +|**DBL_MIN**|2.2250738585072014e-308|Minimum normalized positive value| |
| 88 | +|**DBL_MIN_10_EXP**|(-307)|Minimum decimal exponent| |
| 89 | +|**DBL_MIN_EXP**|(-1021)|Minimum binary exponent| |
| 90 | +|**_DBL_RADIX**|2|Exponent radix| |
| 91 | +|**DBL_TRUE_MIN**|4.9406564584124654e-324|Minimum positive subnormal value| |
| 92 | +|**FLT_DECIMAL_DIG**|9|Number of decimal digits of rounding precision| |
| 93 | +|**FLT_DIG**|6|Number of decimal digits of precision| |
| 94 | +|**FLT_EPSILON**|1.192092896e-07F|Smallest such that 1.0 + **FLT_EPSILON** != 1.0| |
| 95 | +|**FLT_HAS_SUBNORM**|1|Type supports subnormal (denormal) numbers| |
| 96 | +|**FLT_MANT_DIG**|24|Number of bits in significand (mantissa)| |
| 97 | +|**FLT_MAX**|3.402823466e+38F|Maximum value| |
| 98 | +|**FLT_MAX_10_EXP**|38|Maximum decimal exponent| |
| 99 | +|**FLT_MAX_EXP**|128|Maximum binary exponent| |
| 100 | +|**FLT_MIN**|1.175494351e-38F|Minimum normalized positive value| |
| 101 | +|**FLT_MIN_10_EXP**|(-37)|Minimum decimal exponent| |
| 102 | +|**FLT_MIN_EXP**|(-125)|Minimum binary exponent| |
| 103 | +|**FLT_RADIX**|2|Exponent radix| |
| 104 | +|**FLT_TRUE_MIN**|1.401298464e-45F|Minimum positive subnormal value| |
| 105 | +|**LDBL_DIG**|15|# of decimal digits of precision| |
| 106 | +|**LDBL_EPSILON**|2.2204460492503131e-016|Smallest such that 1.0 + **LDBL_EPSILON** != 1.0| |
| 107 | +|**LDBL_HAS_SUBNORM**|1|Type supports subnormal (denormal) numbers| |
| 108 | +|**LDBL_MANT_DIG**|53|# of bits in significand (mantissa)| |
| 109 | +|**LDBL_MAX**|1.7976931348623158e+308|Maximum value| |
| 110 | +|**LDBL_MAX_10_EXP**|308|Maximum decimal exponent| |
| 111 | +|**LDBL_MAX_EXP**|1024|Maximum binary exponent| |
| 112 | +|**LDBL_MIN**|2.2250738585072014e-308|Minimum normalized positive value| |
| 113 | +|**LDBL_MIN_10_EXP**|(-307)|Minimum decimal exponent| |
| 114 | +|**LDBL_MIN_EXP**|(-1021)|Minimum binary exponent| |
| 115 | +|**_LDBL_RADIX**|2|Exponent radix| |
| 116 | +|**LDBL_TRUE_MIN**|4.9406564584124654e-324|Minimum positive subnormal value| |
| 117 | +|**DECIMAL_DIG**|same as **DBL_DECIMAL_DIG**|Default (double) decimal digits of rounding precision| |
| 118 | + |
| 119 | +## See also |
| 120 | + |
| 121 | +[Global Constants](../c-runtime-library/global-constants.md) |
0 commit comments