ocaml: phase 6 Float module: sqrt/sin/cos/pow/floor/ceil/round/pi (+6 tests, 378 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

Wraps host SX math primitives via _float_* builtins. Float.pi is a
Float literal in the OCaml-side module.
This commit is contained in:
2026-05-08 13:58:52 +00:00
parent ee002f2e02
commit 986b15c0e5
4 changed files with 43 additions and 1 deletions

View File

@@ -922,6 +922,20 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 2304)
(eval "(ocaml-type-of \"fun x y -> x +. y\")")
;; ── Float module ───────────────────────────────────────────────
(epoch 2400)
(eval "(ocaml-run \"Float.sqrt 16.0\")")
(epoch 2401)
(eval "(ocaml-run \"Float.sin 0.0\")")
(epoch 2402)
(eval "(ocaml-run \"Float.cos 0.0\")")
(epoch 2403)
(eval "(ocaml-run \"Float.pow 2.0 10.0\")")
(epoch 2404)
(eval "(ocaml-run \"Float.floor 3.7\")")
(epoch 2405)
(eval "(ocaml-run \"Float.ceil 3.2\")")
EPOCHS
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1458,6 +1472,14 @@ check 2302 "10.0 /. 4.0" '2.5'
check 2303 "type 1.5 +. 2.5" '"Float"'
check 2304 "type fun x y -> x +. y" '"Float -> Float -> Float"'
# ── Float module ────────────────────────────────────────────────
check 2400 "Float.sqrt 16" '4'
check 2401 "Float.sin 0" '0'
check 2402 "Float.cos 0" '1'
check 2403 "Float.pow 2 10" '1024'
check 2404 "Float.floor 3.7" '3'
check 2405 "Float.ceil 3.2" '4'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"