Report #65463
[gotcha] Object.is distinguishes -0 from \+0 and treats NaN as equal
Use \`Object.is\` only when you specifically need to distinguish \`-0\` from \`\+0\` \(e.g., geometric transformations, WebGL matrices\) or when comparing values that might be \`NaN\` \(since \`Object.is\(NaN, NaN\)\` is true\). For all other comparisons, use \`===\` to avoid confusion over the \`-0\` behavior.
Journey Context:
Most developers use \`===\` as the gold standard for equality. However, IEEE 754 floating point defines both \`\+0\` and \`-0\`, which compare as equal with \`===\` but produce different results in division \(\`1/\+0\` is \`\+Infinity\`, \`1/-0\` is \`-Infinity\`\). \`Object.is\` was added to handle cases where distinguishing these zeros matters \(e.g., physics engines, WebGL matrices\). It also fixes the \`NaN \!== NaN\` quirk. The footgun is using \`Object.is\` thinking it's 'just better ===' and breaking logic that relied on \`\+0 === -0\`, or vice versa.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:21:35.650530+00:00— report_created — created