math refactor #469
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq!469
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fmath"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
● Full just ci green: fmt, clippy, unit tests, compiler/LSP/examples build, integration tests (41 passed including
all 23 new builtins), seq lint, binary contents.
Summary of changes
Runtime (crates/runtime/src/float_ops.rs)
atan, floor, ceil, round (round_ties_even/banker's), trunc.
Compiler signatures (crates/compiler/src/builtins/float.rs) — 23 builtin! lines, 23 doc strings (f.round calls
out banker's; f.atan2 and f.pow call out arg order).
Codegen wiring — both crates/compiler/src/codegen/runtime/float.rs (DECLS + SYMBOLS) and
crates/compiler/src/ast/program.rs (validate_word_calls known-builtins list).
Linker (crates/compiler/src/lib.rs) — added -lm so libm symbols (sin, cos, exp, log, pow, atan, …) referenced by
the runtime archive resolve. Comment explains why it's needed (clang only auto-links libm for math in the IR,
not via the runtime).
Stdlib cleanup (crates/compiler/stdlib/imath.seq)
Call-site updates
choice).
test-division.seq).
Docs (docs/STDLIB_REFERENCE.md)
Migration doc (docs/MIGRATION_7_0.md) — created with two rules: (1) mod → i.modulo; (2) float math builtins are
additive, no migration required, with semantics notes (banker's rounding, f.atan2 ( y x -- ), f.pow ( base exp
-- )).
Integration tests (tests/integration/src/test-std-fmath.seq) — 22 new test words covering every checkpoint in
the design plus per-group smoke tests, all using exact-result inputs to avoid float-equality fragility.
Diff lives unstaged in your worktree (per your git rule).