192000000000000005 can not be represented by a Number in javascript, due to the limitations of 64bit floating point representation
The Maximum integer that is safe (i.e. all integers up to that integer can be represented without gaps) is Number.MAX_SAFE_INTEGER === 9,007,199,254,740,991
you can see that's 16 digits - so 18 digits is not safe, and 19 (whatever, you've never tried) won't work either -
Note, the actual definition of MAX_SAFE_INTEGER is
the largest integer n
, where n
and n + 1
are both exactly representable as a Number
value
console.log(9007199254740991) //=> 9007199254740991
console.log(9007199254740992) //=> 9007199254740992
console.log(9007199254740993) //=> 9007199254740992
So, while 9007199254740992
is representable as a Number, because 9007199254740993
also has the same value when stored in a 64bit float, it is not "safe"
note 9007199254740991
is 2**53 - 1
- which makes sense when you know that 64bit floating point has a 53 bit mantissa
Mozilla Developer Network Documentation