Previously NaN / Infinity were SX symbols that couldn't be (define)'d because the SX tokenizer parses 'NaN' and 'Infinity' as numeric literals. js-transpile-ident now rewrites NaN -> (js-nan-value), Infinity -> (js-infinity-value), each a zero-arg function returning the appropriate IEEE value ((/ 0.0 0.0) and (/ 1.0 0.0)). Also fixes js-number-is-nan: in this SX, (= nan nan) returns true, so the classic 'v !== v' trick doesn't work. Now checks (inspect v) against 'nan'/'-nan' strings. Extends js-strict-eq: NaN === NaN returns false per ES spec. 8 new unit tests, 497/499 total. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
87 KiB
87 KiB