1# basic_json::number_unsigned_t
2
3```cpp
4using number_unsigned_t = NumberUnsignedType;
5```
6
7The type used to store JSON numbers (unsigned).
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_integer_t.md), `number_unsigned_t` and [`number_float_t`](number_float_t.md) are
18used.
19
20To store unsigned integer numbers in C++, a type is defined by the template parameter `NumberUnsignedType` which chooses
21the type to use.
22
23## Notes
24
25#### Default type
26
27With the default values for `NumberUnsignedType` (`std::uint64_t`), the default value for `number_unsigned_t` is
28`#!cpp std::uint64_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 `18446744073709551615` (UINT64_MAX) and
43the minimal integer number that can be stored is `0`. Integer numbers that are out of range will yield over/underflow
44when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored
45as [`number_integer_t`](number_integer_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 (when considered in conjunction with the `number_integer_t` type) of the exactly supported
52range [0, UINT64_MAX], this class's integer type is interoperable.
53
54#### Storage
55
56Integer number values are stored directly inside a `basic_json` type.
57
58## Version history
59
60- Added in version 2.0.0.
61