#12: MAX_SAFE_INTEGER + 1 === MAX_SAFE_INTEGER + 2
Topic: numbers · Difficulty: ★★★
console.log(Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2);Output
true
Why
Number.MAX_SAFE_INTEGER (2^53 - 1) is the largest integer that IEEE-754 doubles can represent with exact, one-to-one precision. Beyond it, the available bits can no longer distinguish every integer, so the float format starts rounding to the nearest representable value in steps of 2. MAX_SAFE_INTEGER + 1 and MAX_SAFE_INTEGER + 2 both round to the same underlying bit pattern, so they end up strictly equal — a visible symptom of floating-point precision loss, not a bug in ===.
More numbers puzzles