JavaScript (ES2026) reference · Number Methods and Properties
JavaScript Number.EPSILON Property
The smallest difference between 1 and the next representable number, used as a tolerance when comparing floats.
JavaScript (ES2026) Since ES2015
Syntax
Number.EPSILON
Return value
About 2.220446049250313e-16.
Examples
console.log(Number.EPSILON);
Output
2.220446049250313e-16
const nearlyEqual = (a, b) => Math.abs(a - b) < Number.EPSILON;
console.log(0.1 + 0.2 === 0.3, nearlyEqual(0.1 + 0.2, 0.3));
Output
false true
Version history
| Version | Change |
|---|---|
| JavaScript ES2015 | Added |
Related
Math.abs()· Return the absolute value of a number: its distance from zero, so Math.abs(-5) is 5.Number.MAX_SAFE_INTEGER· The largest integer JavaScript numbers can represent exactly: 2^53 - 1, or 9,007,199,254,740,991.- JavaScript Numbers · tutorial
- JavaScript Type Conversion · tutorial