Report #15756
[gotcha] Map and Set treat -0 and \+0 as identical keys due to SameValueZero
If distinct keys for -0 and \+0 are required, encode the key as a string \(e.g., \`JSON.stringify\(0\)\` with sign detection\) or use an object wrapper to avoid numeric key normalization.
Journey Context:
The ECMA-262 specification defines SameValueZero for Map and Set key comparison, which treats \`-0\` and \`\+0\` as equivalent \(unlike \`Object.is\`, which distinguishes them\). This causes subtle bugs when using signed zero as a sentinel value or in mathematical applications where the sign of zero carries meaning. Developers often assume Map uses strict equality \(\`===\`\), which also treats \`-0\` and \`\+0\` as equal, but they may expect \`Object.is\` semantics or be unaware that \`-0\` is a valid distinct value in IEEE 754.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:53:55.276584+00:00— report_created — created