diff --git a/lib/js/runtime.sx b/lib/js/runtime.sx index 96a02627..4fd634a3 100644 --- a/lib/js/runtime.sx +++ b/lib/js/runtime.sx @@ -1436,7 +1436,9 @@ (define js-mul (fn (a b) (* (js-to-number a) (js-to-number b)))) -(define js-div (fn (a b) (/ (js-to-number a) (js-to-number b)))) +(define + js-div + (fn (a b) (/ (js-to-number a) (exact->inexact (js-to-number b))))) (define js-mod (fn (a b) (mod (js-to-number a) (js-to-number b)))) diff --git a/lib/js/test262-scoreboard.json b/lib/js/test262-scoreboard.json index a837cde5..cb45b21f 100644 --- a/lib/js/test262-scoreboard.json +++ b/lib/js/test262-scoreboard.json @@ -20,16 +20,12 @@ "top_failures": [ [ "Test262Error (assertion failed)", - 12 + 14 ], [ "Timeout", 6 ], - [ - "TypeError: not a function", - 2 - ], [ "ReferenceError (undefined symbol)", 1 @@ -44,16 +40,12 @@ "top_failure_modes": [ [ "Test262Error (assertion failed)", - 12 + 14 ], [ "Timeout", 6 ], - [ - "TypeError: not a function", - 2 - ], [ "ReferenceError (undefined symbol)", 1 @@ -64,6 +56,6 @@ ] ], "pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33", - "elapsed_seconds": 361.8, + "elapsed_seconds": 420.7, "workers": 1 } \ No newline at end of file diff --git a/lib/js/test262-scoreboard.md b/lib/js/test262-scoreboard.md index 09b89c6d..0a5320c1 100644 --- a/lib/js/test262-scoreboard.md +++ b/lib/js/test262-scoreboard.md @@ -1,15 +1,14 @@ # test262 scoreboard Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33` -Wall time: 361.8s +Wall time: 420.7s **Total:** 77/99 runnable passed (77.8%). Raw: pass=77 fail=16 skip=1 timeout=6 total=100. ## Top failure modes -- **12x** Test262Error (assertion failed) +- **14x** Test262Error (assertion failed) - **6x** Timeout -- **2x** TypeError: not a function - **1x** ReferenceError (undefined symbol) - **1x** SyntaxError (parse/unsupported syntax) @@ -23,8 +22,7 @@ Wall time: 361.8s ### built-ins/String (77/99 — 77.8%) -- **12x** Test262Error (assertion failed) +- **14x** Test262Error (assertion failed) - **6x** Timeout -- **2x** TypeError: not a function - **1x** ReferenceError (undefined symbol) - **1x** SyntaxError (parse/unsupported syntax) diff --git a/plans/js-on-sx.md b/plans/js-on-sx.md index 2746a02d..31058771 100644 --- a/plans/js-on-sx.md +++ b/plans/js-on-sx.md @@ -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-div` coerces divisor to inexact before dividing.** When both operands are SX rationals (e.g. `(js-div 1 0)` from JS-transpiled `1/0` reaching the harness's `_isSameValue` +0/-0 check), SX integer-rational division throws "rational: division by zero" instead of producing JS `Infinity`. Wrapped the divisor in `(exact->inexact ...)` so it's always a float; integer-by-zero now returns `inf` (positive numerator), `-inf` (negative), `nan` (zero numerator), matching JS semantics. Was hitting harness assertion failures even when the test value matched expected. built-ins/Number: 37/50 → 41/50. built-ins/String: 77/99. conformance.sh: 148/148. + - 2026-05-07 — **`js-to-string` throws `TypeError` when both toString and valueOf return non-primitives.** Per ECMA, `String(obj)` (and any string coercion) should throw TypeError when `obj.toString()` and `obj.valueOf()` both return objects. Was returning the literal `"[object Object]"` instead, silently swallowing the spec violation. Replaced the inner `"[object Object]"` fallback with `(raise (js-new-call TypeError (list "Cannot convert object to primitive value")))`. Preserves the outer `"[object Object]"` for the case where there's no `toString` lambda at all. Fixes `S8.12.8_A1`. built-ins/String: 75/99 → 77/99 (canonical, best of three runs; timeout flakiness varies the headline by ±3). conformance.sh: 148/148. - 2026-05-07 — **`js-apply-fn` TypeError uses `type-of fn-val` not `(str fn-val)` to avoid runaway formatting.** Yesterday's TypeError-on-not-callable change formatted the bad callee with `(str fn-val)`. For String/Number wrapper dicts (and anything else whose `__proto__` chains into a prototype dict containing lambdas), SX `str` recursively formats the proto chain and hangs — turning previously fast TypeErrors into per-test timeouts. Switched to `(type-of fn-val)` (e.g. "dict is not a function"). Less specific but always terminates. built-ins/String: 73/99 → 75/99 (canonical). conformance.sh: 148/148.