haskell: Phase 10 — math builtins (sqrt/floor/ceiling/round/truncate) (+6 tests, 28/28)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m15s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 08:01:48 +00:00
parent 1b7bd86b43
commit ef33e9a43a
3 changed files with 45 additions and 1 deletions

View File

@@ -160,7 +160,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
ints (`1.0e10``"10000000000"`) because our system can't distinguish
`42` from `42.0` — both are SX numbers where `integer?` is true. Existing
tests like `show 42 = "42"` rely on this rendering. Documented in `numerics.sx`._
- [ ] Math builtins: `sqrt`, `floor`, `ceiling`, `round`, `truncate` — call
- [x] Math builtins: `sqrt`, `floor`, `ceiling`, `round`, `truncate` — call
the corresponding SX numeric primitives.
- [ ] `Fractional` typeclass stub: `(/)`, `recip`, `fromRational`.
- [ ] `Floating` typeclass stub: `pi`, `exp`, `log`, `sin`, `cos`, `(**)`
@@ -301,6 +301,12 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
_Newest first._
**2026-05-07** — Phase 10 math builtins (sqrt/floor/ceiling/round/truncate):
- Inserted in the post-prelude `begin` block so they override the prelude's
identity stubs. `ceiling` is the only one needing a definition (SX doesn't
ship one — derived from `floor`). `sqrt`, `floor`, `round`, `truncate`
thunk through to SX primitives. 6 new tests in `numerics.sx` (now 28/28).
**2026-05-07** — Phase 10 Float display through `hk-show-val`:
- Added `hk-show-num` and `hk-show-float-sci` helpers in `eval.sx`. Number
formatting: `integer?` → decimal (covers all whole-valued numbers, both ints