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

@@ -67,6 +67,14 @@
(list "print_string" (fn (s) (begin (print s) nil)))
(list "print_endline" (fn (s) (begin (println s) nil)))
(list "print_int" (fn (i) (begin (print (str i)) nil)))
;; Float math primitives.
(list "_float_sqrt" (fn (x) (sqrt x)))
(list "_float_sin" (fn (x) (sin x)))
(list "_float_cos" (fn (x) (cos x)))
(list "_float_pow" (fn (a) (fn (b) (pow a b))))
(list "_float_floor" (fn (x) (floor x)))
(list "_float_ceil" (fn (x) (ceil x)))
(list "_float_round" (fn (x) (round x)))
;; Polymorphic compare — returns negative / 0 / positive like
;; OCaml's Stdlib.compare. Defers to host SX `<` and `>`.
(list "compare"