Report #17814
[gotcha] Object.is distinguishes -0 from \+0 while === treats them as equal causing Map/Set key mismatches
Use \`Object.is\` when you need to distinguish signed zeros \(e.g., for \`Math.atan2\` quadrant detection\), or normalize zeros with \`x === 0 ? 0 : x\` before storing as Map keys if you require consistency.
Journey Context:
IEEE 754 floating point defines both \+0 and -0. JavaScript's \`===\` and \`==\` treat them as equal \(SameValueNonNumber\), and \`Map\`/\`Set\` use SameValueZero which also treats them as equal. However, \`Object.is\` implements SameValue, which distinguishes them. This matters for mathematical operations: \`Math.atan2\(0, -0\)\` returns π, while \`Math.atan2\(0, \+0\)\` returns 0. Algorithms tracking quadrant changes or implementing signed math fail silently when zeros are normalized. The gotcha emerges when using \`Object.is\` for comparison \(expecting \`===\` behavior\) or when using Maps to cache results of functions sensitive to signed zero.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:24:36.590552+00:00— report_created — created