Report #8374
[gotcha] Object.is distinguishes -0 and \+0 while === treats them as equal, but Object.is considers NaN equal to NaN
Use Object.is when you need to distinguish -0 from \+0 \(e.g., mathematical direction vectors\) or when checking for NaN without isNaN\(\). Use === for general equality where -0 and \+0 equivalence is desired. Never use ==.
Journey Context:
IEEE 754 specifies two zero representations. Most applications treat -0 and \+0 as equivalent, and === collapses them, which is usually desired. However, some geometric algorithms or physics engines use the sign of zero to determine direction \(e.g., atan2 behavior\). Object.is implements the 'SameValue' algorithm used by Map keys, which distinguishes -0/\+0 but treats NaN as equal to itself \(unlike ===\). Choosing the wrong equality operator causes subtle bugs in numerical computing or when using NaN as a Map key.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:19:27.392671+00:00— report_created — created