1# basic_json::number_integer_t 2 3```cpp 4using number_integer_t = NumberIntegerType; 5``` 6 7The type used to store JSON numbers (integers). 8 9[RFC 8259](https://tools.ietf.org/html/rfc8259) describes numbers as follows: 10> The representation of numbers is similar to that used in most programming languages. A number is represented in base 11> 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may 12> be followed by a fraction part and/or an exponent part. Leading zeros are not allowed. (...) Numeric values that 13> cannot be represented in the grammar below (such as Infinity and NaN) are not permitted. 14 15This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is 16known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different 17types, `number_integer_t`, [`number_unsigned_t`](number_unsigned_t.md) and [`number_float_t`](number_float_t.md) are 18used. 19 20To store integer numbers in C++, a type is defined by the template parameter `NumberIntegerType` which chooses the type 21to use. 22 23## Notes 24 25#### Default type 26 27With the default values for `NumberIntegerType` (`std::int64_t`), the default value for `number_integer_t` is 28`#!cpp std::int64_t`. 29 30#### Default behavior 31 32- The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an 33 interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer 34 literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. 35- Not-a-number (NaN) values will be serialized to `null`. 36 37#### Limits 38 39[RFC 8259](https://tools.ietf.org/html/rfc8259) specifies: 40> An implementation may set limits on the range and precision of numbers. 41 42When the default type is used, the maximal integer number that can be stored is `9223372036854775807` (INT64_MAX) and 43the minimal integer number that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers that are out of 44range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers 45will be automatically be stored as [`number_unsigned_t`](number_unsigned_t.md) or [`number_float_t`](number_float_t.md). 46 47[RFC 8259](https://tools.ietf.org/html/rfc8259) further states: 48> Note that when such software is used, numbers that are integers and are in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are 49> interoperable in the sense that implementations will agree exactly on their numeric values. 50 51As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is 52interoperable. 53 54#### Storage 55 56Integer number values are stored directly inside a `basic_json` type. 57 58## Version history 59 60- Added in version 1.0.0. 61