diff --git a/lib/lua/runtime.sx b/lib/lua/runtime.sx index ecf8bac5..3f4fa4be 100644 --- a/lib/lua/runtime.sx +++ b/lib/lua/runtime.sx @@ -1336,6 +1336,9 @@ (define lua-math-atan (fn (x) (atan (lua-math-num "atan" x)))) (define lua-math-atan2 (fn (y x) (atan2 (lua-math-num "atan2" y) (lua-math-num "atan2" x)))) (define lua-math-pow (fn (a b) (pow (lua-math-num "pow" a) (lua-math-num "pow" b)))) +(define lua-math-sinh (fn (x) (sinh (lua-math-num "sinh" x)))) +(define lua-math-cosh (fn (x) (cosh (lua-math-num "cosh" x)))) +(define lua-math-tanh (fn (x) (tanh (lua-math-num "tanh" x)))) (define lua-math-log (fn (&rest args) @@ -1421,6 +1424,9 @@ (dict-set! math "acos" lua-math-acos) (dict-set! math "atan" lua-math-atan) (dict-set! math "atan2" lua-math-atan2) +(dict-set! math "sinh" lua-math-sinh) +(dict-set! math "cosh" lua-math-cosh) +(dict-set! math "tanh" lua-math-tanh) (dict-set! math "deg" lua-math-deg) (dict-set! math "rad" lua-math-rad) (dict-set! math "min" lua-math-min) diff --git a/lib/lua/scoreboard.json b/lib/lua/scoreboard.json index cfaf345a..0946325e 100644 --- a/lib/lua/scoreboard.json +++ b/lib/lua/scoreboard.json @@ -1,8 +1,8 @@ { "totals": { "pass": 1, - "fail": 11, - "timeout": 4, + "fail": 12, + "timeout": 3, "skip": 8, "total": 24, "runnable": 16, @@ -11,11 +11,11 @@ "top_failure_modes": [ [ "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - 6 + 7 ], [ "timeout", - 4 + 3 ], [ "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio", @@ -51,7 +51,7 @@ "name": "attrib.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: module 'C' not found\\\\\\\"\\", - "ms": 6537 + "ms": 6636 }, { "name": "big.lua", @@ -63,7 +63,7 @@ "name": "calls.lua", "status": "fail", "reason": "undefined symbol: fat\\", - "ms": 4965 + "ms": 5129 }, { "name": "checktable.lua", @@ -75,7 +75,7 @@ "name": "closure.lua", "status": "timeout", "reason": "per-test timeout", - "ms": 8003 + "ms": 8001 }, { "name": "code.lua", @@ -87,7 +87,7 @@ "name": "constructs.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to compare incompat", - "ms": 7725 + "ms": 6962 }, { "name": "db.lua", @@ -99,13 +99,13 @@ "name": "errors.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 4342 + "ms": 3442 }, { "name": "events.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 7779 + "ms": 7474 }, { "name": "files.lua", @@ -123,13 +123,13 @@ "name": "literals.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 1857 + "ms": 1965 }, { "name": "locals.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio", - "ms": 1856 + "ms": 1784 }, { "name": "main.lua", @@ -141,43 +141,43 @@ "name": "math.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio", - "ms": 5615 + "ms": 4413 }, { "name": "nextvar.lua", - "status": "timeout", - "reason": "per-test timeout", - "ms": 8007 + "status": "fail", + "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", + "ms": 7389 }, { "name": "pm.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 6139 + "ms": 6252 }, { "name": "sort.lua", "status": "timeout", "reason": "per-test timeout", - "ms": 8003 + "ms": 8004 }, { "name": "strings.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 4505 + "ms": 4236 }, { "name": "vararg.lua", "status": "fail", "reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\", - "ms": 3031 + "ms": 2348 }, { "name": "verybig.lua", "status": "pass", "reason": "", - "ms": 1213 + "ms": 1074 } ] } \ No newline at end of file diff --git a/lib/lua/scoreboard.md b/lib/lua/scoreboard.md index da53eb8f..2fc7cca1 100644 --- a/lib/lua/scoreboard.md +++ b/lib/lua/scoreboard.md @@ -1,12 +1,12 @@ # Lua-on-SX conformance scoreboard **Pass rate:** 1/16 runnable (6.2%) -fail=11 timeout=4 skip=8 total=24 +fail=12 timeout=3 skip=8 total=24 ## Top failure modes -- **6x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ -- **4x** timeout +- **7x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ +- **3x** timeout - **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio - **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ - **1x** undefined symbol: fat\ @@ -18,25 +18,25 @@ fail=11 timeout=4 skip=8 total=24 |---|---|---|---:| | all.lua | skip | driver uses dofile to chain other tests | 0 | | api.lua | skip | requires testC (C debug library) | 0 | -| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ | 6537 | +| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ | 6636 | | big.lua | timeout | per-test timeout | 8008 | -| calls.lua | fail | undefined symbol: fat\ | 4965 | +| calls.lua | fail | undefined symbol: fat\ | 5129 | | checktable.lua | skip | internal debug helpers | 0 | -| closure.lua | timeout | per-test timeout | 8003 | +| closure.lua | timeout | per-test timeout | 8001 | | code.lua | skip | bytecode inspection via debug library | 0 | -| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat | 7725 | +| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat | 6962 | | db.lua | skip | debug library | 0 | -| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4342 | -| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7779 | +| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3442 | +| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7474 | | files.lua | skip | io library | 0 | | gc.lua | skip | collectgarbage / finalisers | 0 | -| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1857 | -| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1856 | +| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1965 | +| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1784 | | main.lua | skip | standalone interpreter driver | 0 | -| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 5615 | -| nextvar.lua | timeout | per-test timeout | 8007 | -| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6139 | -| sort.lua | timeout | per-test timeout | 8003 | -| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4505 | -| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3031 | -| verybig.lua | pass | - | 1213 | +| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 4413 | +| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7389 | +| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6252 | +| sort.lua | timeout | per-test timeout | 8004 | +| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4236 | +| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2348 | +| verybig.lua | pass | - | 1074 | diff --git a/plans/lua-on-sx.md b/plans/lua-on-sx.md index 9607c63a..42fbad15 100644 --- a/plans/lua-on-sx.md +++ b/plans/lua-on-sx.md @@ -82,6 +82,7 @@ Each item: implement → tests → tick box → update progress log. _Newest first. Agent appends on every commit._ +- 2026-04-25: lua: scoreboard iteration — `math.sinh`/`cosh`/`tanh` (Lua 5.1 hyperbolic). 393/393 green; scoreboard unchanged. - 2026-04-25: lua: scoreboard iteration — tried two-phase eval (extract top-level `function f` decls, evaluate them BEFORE the guard so they leak to top-level env, then run the rest inside guard). Broke method-decl tests because `function a:add(...)` requires `a` to exist, and `a = {...}` was in the deferred phase-2. Reverted. Real fix needs `_G` table or AST-level rewriting of top-level returns into chunk-result mutations. 393/393 green. - 2026-04-25: lua: scoreboard iteration — `string.dump` stub (returns string-of-fn). Diagnosed calls.lua: file ENDS with `return deep` (line 295), which makes my `lua-has-top-return?` correctly return true, triggering the guard, which scopes user defines and breaks loadstring's lexical capture of `fat`. The fix would require either rewriting top-level returns into a different mechanism (post-processing the AST) or implementing a real `_G` global table for global assignment/lookup. Both larger. - 2026-04-25: lua: scoreboard iteration — `math.mod` (Lua 5.0 alias for `fmod`), `math.frexp` (mantissa/exponent split), `math.ldexp` (m·2^e). math.lua moves past line-103 `math.mod` call. Timeouts 6→3, asserts 5→7. 393/393 green.