js-on-sx: js-num-from-string uses pow (float) for exponent
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m4s

js-pow-int 10 20 overflows int64 (10^20 > 2^63), so numeric literals
like 1e20 and 100000000000000000000 were parsing as
-1457092405402533888. The pow primitive uses float-domain
exponentiation and produces 1e+20 correctly. Single call swap in
js-num-from-string. built-ins/String (with --restart-every 1):
67/99 → 70/99. conformance.sh: 148/148.
This commit is contained in:
2026-05-07 13:42:32 +00:00
parent 66f13c95d5
commit c81e3f3705
4 changed files with 50 additions and 26 deletions

View File

@@ -1073,7 +1073,8 @@
((trimmed (js-trim s)))
(cond
((= trimmed "") 0)
((js-hex-prefix? trimmed) (js-parse-hex trimmed 2 0))
((js-hex-prefix? trimmed)
(js-parse-hex trimmed 2 0))
(else
(let
((esplit (js-find-exp-char trimmed)))
@@ -1082,12 +1083,28 @@
(let
((mant (js-string-slice trimmed 0 esplit))
(expstr
(js-string-slice trimmed (+ esplit 1) (len trimmed))))
(js-string-slice
trimmed
(+ esplit 1)
(len trimmed))))
(let
((m (js-parse-decimal mant 0 0 1 false 0))
(e (js-parse-decimal expstr 0 0 1 false 0)))
(* m (js-pow-int 10 e))))
(js-parse-decimal trimmed 0 0 1 false 0))))))))
(e
(js-parse-decimal
expstr
0
0
1
false
0)))
(* m (pow 10 e))))
(js-parse-decimal
trimmed
0
0
1
false
0))))))))
(define js-trim (fn (s) (js-trim-left (js-trim-right s))))

View File

@@ -1,9 +1,9 @@
{
"totals": {
"pass": 67,
"fail": 19,
"fail": 26,
"skip": 1,
"timeout": 13,
"timeout": 6,
"total": 100,
"runnable": 99,
"pass_rate": 67.7
@@ -13,18 +13,22 @@
"category": "built-ins/String",
"total": 100,
"pass": 67,
"fail": 19,
"fail": 26,
"skip": 1,
"timeout": 13,
"timeout": 6,
"pass_rate": 67.7,
"top_failures": [
[
"Test262Error (assertion failed)",
15
14
],
[
"TypeError: not a function",
8
],
[
"Timeout",
13
6
],
[
"Unhandled: Not callable: \\\\\\",
@@ -33,10 +37,6 @@
[
"ReferenceError (undefined symbol)",
1
],
[
"SyntaxError (parse/unsupported syntax)",
1
]
]
}
@@ -44,11 +44,15 @@
"top_failure_modes": [
[
"Test262Error (assertion failed)",
15
14
],
[
"TypeError: not a function",
8
],
[
"Timeout",
13
6
],
[
"Unhandled: Not callable: \\\\\\",
@@ -64,6 +68,6 @@
]
],
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
"elapsed_seconds": 580.2,
"elapsed_seconds": 364.7,
"workers": 1
}

View File

@@ -1,14 +1,15 @@
# test262 scoreboard
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
Wall time: 580.2s
Wall time: 364.7s
**Total:** 67/99 runnable passed (67.7%). Raw: pass=67 fail=19 skip=1 timeout=13 total=100.
**Total:** 67/99 runnable passed (67.7%). Raw: pass=67 fail=26 skip=1 timeout=6 total=100.
## Top failure modes
- **15x** Test262Error (assertion failed)
- **13x** Timeout
- **14x** Test262Error (assertion failed)
- **8x** TypeError: not a function
- **6x** Timeout
- **2x** Unhandled: Not callable: \\\
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)
@@ -17,14 +18,14 @@ Wall time: 580.2s
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|---|---:|---:|---:|---:|---:|---:|
| built-ins/String | 67 | 19 | 1 | 13 | 100 | 67.7% |
| built-ins/String | 67 | 26 | 1 | 6 | 100 | 67.7% |
## Per-category top failures (min 10 runnable, worst first)
### built-ins/String (67/99 — 67.7%)
- **15x** Test262Error (assertion failed)
- **13x** Timeout
- **14x** Test262Error (assertion failed)
- **8x** TypeError: not a function
- **6x** Timeout
- **2x** Unhandled: Not callable: \\\
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)

View File

@@ -158,6 +158,8 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
- 2026-05-07 — **`js-num-from-string` uses `pow` (float) instead of `js-pow-int` for the exponent.** Numeric literals like `1e20` and `100000000000000000000` were parsing as `-1457092405402533888` because `js-pow-int 10 20` overflows int64 (10^20 > 2^63). The OCaml SX `pow` primitive uses float-domain power and produces `1e+20` correctly. Replaced the single `(js-pow-int 10 e)` call in `js-num-from-string` with `(pow 10 e)`. Fixes `String(1e20)`, `String(1e30)`, `String(100000000000000000000)`, etc. With isolation built-ins/String 67/99 → 70/99. conformance.sh: 148/148.
- 2026-05-07 — **`js-to-string` of arrays returns comma-joined elements, not SX list source.** `String([1,2,3])` was returning `"(1 2 3)"` (SX `(str v)` formatting) — should be `"1,2,3"`. Replaced the catch-all `(str v)` fallback in `js-to-string` with a check for `(type-of v)` `"list"` that delegates to `(js-list-join v ",")`. Fixes `String(new Array(...))`, `"" + arr`, and any implicit array-to-string coercion. built-ins/String 65/99 → 67/99. conformance.sh: 148/148.
- 2026-05-07 — **JS lexer: handle `\uXXXX` and `\xXX` escape sequences in string literals.** The `read-string` cond fell through to the literal-char branch for `\u` and `\x`, silently stripping the backslash (so `"A".length` returned 5 instead of 1). Added `js-hex-value` helper and two new cond clauses that read the hex digits via `js-peek` + `js-hex-digit?`, compute the code point, and emit it via `char-from-code`. Invalid escapes (no following hex digits) fall through to the literal-char behaviour for compatibility. With test isolation (`--restart-every 1`) built-ins/String 65/99 → 68/99. Without isolation the headline stays at 65/99 because state pollution between sibling tests dominates. conformance.sh: 148/148.