Report #88811
[gotcha] NaN breaks naive memoization/cache key equality checks
Use Object.is\(\) instead of === for cache key comparison, or better, use a Map/Set for your cache keys since they use SameValueZero \(treats NaN equal to itself\). Avoid using plain objects with NaN as property keys.
Journey Context:
In IEEE 754 and JS, NaN \!== NaN. This breaks naive memoization like cache\[key\] \|\| compute\(\), where key might be NaN. Map and Set handle this correctly via SameValueZero algorithm. Object.is\(\) also correctly identifies NaN as equal to itself, unlike ===.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:39:20.075609+00:00— report_created — created