Utilizor
Contact Us

Integer vs Float

Precision and floating point arithmetic.

Integer vs Float

JavaScript numbers are always stored as double precision floating point numbers, following the international IEEE 754 standard.

Integers (numbers without a period or exponent notation) are accurate up to 15 digits.

Floating point arithmetic is not always 100% accurate.

let x = 0.2 + 0.1; // 0.30000000000000004

Example

let x = 999999999999999;   // x will be 999999999999999
let y = 9999999999999999;  // y will be 10000000000000000