Proposal: Vec.* vector math + finish Math transcendentals & Ease.elastic #25
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to #2 — the remaining stdlib numerics.
Vec.* (depends on #1)
Vec.make/add/sub/scale/dot/length/normalize/rotate/angle/from_angle/lerp/distance. These pair with thevec2type proposed in #1 (the type system), so they are blocked on #1 — without a 2D vector type there is nothing to return.Finish Math / Ease
Math.pow,Math.exp,Math.logandEase.elasticwere deferred in #2 because they need a fixed-pointexp/2^x(via a range-reduced polynomial or table). Low priority for a game language, but they round out the surface.Blocked on: #1 (vec2 type) for
Vec.*; a fixed-pointexp/logfor the rest.The Math / Ease half of this issue is implemented and pushed to
mainin6e6467b.Shipped (deterministic Q16.16, pure integer IR — bit-identical everywhere):
Math.exp,Math.log(natural log),Math.pow— backed by two new prelude functions:@fn_fx_exp2(range-reduced 5th-order Taylor2^f, then a clamped shift by the integer part) and@fn_fx_log2(llvm.ctlzfor the exponent + an atanh series on(m-1)/(m+1)for the mantissa).exp = 2^(x·log₂e),log = log₂(x)·ln2,pow = 2^(b·log₂a).Ease.elastic— ease-out elastic,2^(-10t)·sin((10t-0.75)·2π/3)+1.Domain note: results must fit the Q16.16 range (
|x| < 32768); larger magnitudes saturate (e.g.pow(2, 16)→ 0). Documented on each page.Tests (
selfhost/tests/transcend.ludic) + docs for all four; reseeded, C-free bootstrap fixpoint holds, all suites green.Left open: the
Vec.*half stays blocked on #1 — without avec2type there is nothing forVec.make/add/dot/normalize/…to return. This issue remains open to track that half.The Vec. half* is now implemented and pushed to
main(121053e), so both halves of this issue are complete — closing.Vector math — shipped as
Vector.*(de-abbreviated from the proposedVec). Rather than block on the full #1 type system, a self-contained value type unblocks it: aVectoris two Q16.16fixedcomponents packed into onei64, so it is copied by value and never allocates (reuses thelong/i64 support from #17;lltymapsVector→ i64). Fifteen deterministic fixed-point ops reusing the existingfx_mul/fx_div/fx_lerpand@fn_fx_*prelude:make/zero/x/y,add/sub/scale/dot,length/distance/normalize/lerp,rotate/angle/from_angle.New
selfhost/emit_vector.ludic, theVectorprimitive type, grammars/LSP tokens, 16 doc pages, and a registered test (verified on a 3-4-5 triangle, a 90° rotation,atan2, lerp, etc.).Math / Ease half was completed earlier in
6e6467b:Math.exp,Math.log,Math.pow(via new@fn_fx_exp2/@fn_fx_log2prelude) andEase.elastic.Separately, the abbreviated names across the language were expanded to full words in the surrounding commits —
Vec→Vector, and while there:Mem→Memory,Sys→System,Net→Network,Collide→Collision, thefnkeyword→function,str→string,ptr/ptrs→pointer/pointers, and theflr/fxbuiltins→floor/fixed.int/bool/Mathkeep their conventional short spelling.All suites green (45 regression, 25 self-host, 29 tool); the C-free bootstrap fixpoint holds and the docs site regenerates cleanly.