std :: numeric_limits :: digits10 is 15 because only values containing 15 digits or less guarantee rounding from decimal to double precision and vice versa. Some 16-digit values will be round-trip, but not all of them. In the case of integers, only those <= 2 ^ 53 = 9007199254740992 guarantee rounding (because they are represented exactly). 9007199254740993, for example, is returned as 9007199254740992.
source
share