From fb0ca374a377f213a1c14edc077dffc5764b307b Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 8 May 2026 03:52:21 +0000 Subject: [PATCH] js-on-sx: Math.X.name maps SX names to JS for trig/log/etc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit js-unmap-fn-name had mappings for older Math methods but not the trig/hyperbolic/log family added later. Added 22 mappings for sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, exp, log, log2, log10, expm1, log1p, clz32, imul, fround. built-ins/Math: 42/45 → 45/45 (100%). conformance.sh: 148/148. --- lib/js/runtime.sx | 22 +++++++++++++++++ lib/js/test262-scoreboard.json | 44 ++++++++++------------------------ lib/js/test262-scoreboard.md | 13 +++------- plans/js-on-sx.md | 2 ++ 4 files changed, 40 insertions(+), 41 deletions(-) diff --git a/lib/js/runtime.sx b/lib/js/runtime.sx index 12cfa681..ef44de7a 100644 --- a/lib/js/runtime.sx +++ b/lib/js/runtime.sx @@ -174,6 +174,28 @@ ((= name "js-math-sign") "sign") ((= name "js-math-cbrt") "cbrt") ((= name "js-math-hypot") "hypot") + ((= name "js-math-sin") "sin") + ((= name "js-math-cos") "cos") + ((= name "js-math-tan") "tan") + ((= name "js-math-asin") "asin") + ((= name "js-math-acos") "acos") + ((= name "js-math-atan") "atan") + ((= name "js-math-atan2") "atan2") + ((= name "js-math-sinh") "sinh") + ((= name "js-math-cosh") "cosh") + ((= name "js-math-tanh") "tanh") + ((= name "js-math-asinh") "asinh") + ((= name "js-math-acosh") "acosh") + ((= name "js-math-atanh") "atanh") + ((= name "js-math-exp") "exp") + ((= name "js-math-log") "log") + ((= name "js-math-log2") "log2") + ((= name "js-math-log10") "log10") + ((= name "js-math-expm1") "expm1") + ((= name "js-math-log1p") "log1p") + ((= name "js-math-clz32") "clz32") + ((= name "js-math-imul") "imul") + ((= name "js-math-fround") "fround") ((= name "js-number-is-finite") "isFinite") ((= name "js-number-is-nan") "isNaN") ((= name "js-number-is-integer") "isInteger") diff --git a/lib/js/test262-scoreboard.json b/lib/js/test262-scoreboard.json index 4d985772..77eca860 100644 --- a/lib/js/test262-scoreboard.json +++ b/lib/js/test262-scoreboard.json @@ -1,45 +1,27 @@ { "totals": { - "pass": 44, - "fail": 6, - "skip": 0, + "pass": 45, + "fail": 0, + "skip": 5, "timeout": 0, "total": 50, - "runnable": 50, - "pass_rate": 88.0 + "runnable": 45, + "pass_rate": 100.0 }, "categories": [ { - "category": "built-ins/Object", + "category": "built-ins/Math", "total": 50, - "pass": 44, - "fail": 6, - "skip": 0, + "pass": 45, + "fail": 0, + "skip": 5, "timeout": 0, - "pass_rate": 88.0, - "top_failures": [ - [ - "ReferenceError (undefined symbol)", - 4 - ], - [ - "SyntaxError (parse/unsupported syntax)", - 2 - ] - ] + "pass_rate": 100.0, + "top_failures": [] } ], - "top_failure_modes": [ - [ - "ReferenceError (undefined symbol)", - 4 - ], - [ - "SyntaxError (parse/unsupported syntax)", - 2 - ] - ], + "top_failure_modes": [], "pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33", - "elapsed_seconds": 42.1, + "elapsed_seconds": 9.0, "workers": 1 } \ No newline at end of file diff --git a/lib/js/test262-scoreboard.md b/lib/js/test262-scoreboard.md index 5da4c0fb..89ffc358 100644 --- a/lib/js/test262-scoreboard.md +++ b/lib/js/test262-scoreboard.md @@ -1,24 +1,17 @@ # test262 scoreboard Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33` -Wall time: 42.1s +Wall time: 9.0s -**Total:** 44/50 runnable passed (88.0%). Raw: pass=44 fail=6 skip=0 timeout=0 total=50. +**Total:** 45/45 runnable passed (100.0%). Raw: pass=45 fail=0 skip=5 timeout=0 total=50. ## Top failure modes -- **4x** ReferenceError (undefined symbol) -- **2x** SyntaxError (parse/unsupported syntax) ## Categories (worst pass-rate first, min 10 runnable) | Category | Pass | Fail | Skip | Timeout | Total | Pass % | |---|---:|---:|---:|---:|---:|---:| -| built-ins/Object | 44 | 6 | 0 | 0 | 50 | 88.0% | +| built-ins/Math | 45 | 0 | 5 | 0 | 50 | 100.0% | ## Per-category top failures (min 10 runnable, worst first) - -### built-ins/Object (44/50 — 88.0%) - -- **4x** ReferenceError (undefined symbol) -- **2x** SyntaxError (parse/unsupported syntax) diff --git a/plans/js-on-sx.md b/plans/js-on-sx.md index f994140c..48480641 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-08 — **`Math.X.name` returns the JS-style method name.** `Math.acos.name`, `Math.acosh.name`, `Math.asin.name` were returning the SX symbol name (`"js-math-acos"` etc.). `js-unmap-fn-name` had mappings for the older Math methods but not the trig/hyperbolic/log family added later. Added mappings for sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, exp, log, log2, log10, expm1, log1p, clz32, imul, fround. built-ins/Math: 42/45 → 45/45 (100%). conformance.sh: 148/148. + - 2026-05-08 — **`fn.constructor === Function` for function instances.** Per ES, every function instance's `constructor` slot points to the `Function` global. Was returning undefined for `(function () {}).constructor`. Added `constructor` to the function-property cond in `js-get-prop`; returns `js-function-global`. Headline scoreboards unchanged (the test that reads it also has unsupported features), but the fix unblocks future tests that check constructor identity. conformance.sh: 148/148. - 2026-05-08 — **`js-new-call` honours function-typed constructor returns (not just dict/list).** `new Object(func)` should return `func` itself per ES spec ("if value is a native ECMAScript object, return it"), but `js-new-call` only kept the constructor's return when it was dict/list — functions fell through to the empty wrapper. Added `(js-function? ret)` to the accept set. Now `new Object(fn) === fn` and `new Object(fn)()` invokes `fn`. built-ins/Object: 42/50 → 44/50. conformance.sh: 148/148.