js-on-sx: exponent notation in js-string-to-number (+3 Number tests)

js-num-from-string now finds an e/E split, parses mantissa and exponent
separately, and combines via js-pow-int (positive-exp loop for >=0, 1/
reciprocal for negative). Previously `.12345e-3` parsed as 0.12345 and
"1e3" returned NaN — the parser walked decimals/dots only.

New helpers:
- js-find-exp-char / -loop : linear scan for e/E, returns -1 if absent
- js-pow-int base exp : integer-exp power, handles negative

Also fixed `js-string-trim` typo → `js-trim` in the rewritten num-from-
string, and corrected test 903's expected part count (3, not 2 — the
lexer has always split `hi ${x}!` into str+expr+str, the test just had
the wrong count).

Unit: 521/522 (was 520/522, 934 still blocked on SX \` escape).
Conformance: 148/148 unchanged.
Number scoreboard: 43/100 → 46/100 (+3).

Impacted test262 paths (sample): built-ins/Number/S9.3.1_A11.js and
A12/A16/A17 (".12345e-3", scientific notation round-trips).
This commit is contained in:
2026-04-24 11:36:56 +00:00
parent dc97c17304
commit 7cffae2148
3 changed files with 46 additions and 2 deletions

View File

@@ -1697,7 +1697,7 @@ check 870 "typeof Promise" '"object"'
check 900 "tpl plain: type" '"template"'
check 901 "tpl plain: value" '"hello"'
check 902 "tpl interp: value is list" 'true'
check 903 "tpl interp: 2 parts" '2'
check 903 "tpl interp: 3 parts" '3'
check 910 "parse plain" '(js-str "hi")'
check 911 'parse interp a${1}b' '(js-tpl ((js-str "a") (js-num 1) (js-str "b")))'