Numbers in javascript are represented using 64 bit floating point values (so called doubles
in other languages).
doubles
can hold at most 15/16 significant digits (depends on number magnitute). Since range of double is 1.7E+/-308 some numbers can only be aproximated by double
, in your case 11111111111111111 cannot be represented exactly but is aproximated by 11111111111111112 value. If this sounds strange then remember that 0.3 cannot be represented exactly as double too.
double
can hold exact integers values in range +/-2^53, when you are operating in this range - you may expect exact values.