refactor(lang): rename builtins flr->floor and fx->fixed
De-abbreviate the two bare fixed-point conversion builtins:
flr(f) -> int -> floor(f) -> int (fixed -> int, flooring)
fx(i) -> fixed -> fixed(i) -> fixed (int -> fixed; mirrors how the
stringify builtin is `string`)
Updates the compiler dispatch, all call sites, the grammars/LSP/JetBrains
tokens, and the docs (fn-flr -> fn-floor, fn-fx -> fn-fixed). Reseeded;
C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
effb3f637f
commit
2e0047514b
19 changed files with 80 additions and 80 deletions
26
docs/language/builtins/fn-fixed.md
Normal file
26
docs/language/builtins/fn-fixed.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
id: fn-fixed
|
||||
name: fixed
|
||||
category: builtins
|
||||
kind: builtin
|
||||
tokens: fixed
|
||||
sig: fixed(n) -> fixed
|
||||
tip: Lift an integer into a Q16.16 fixed-point value.
|
||||
order: 50
|
||||
---
|
||||
|
||||
Converts an integer into a <code>fixed</code> value (Ludic's Q16.16 fixed-point type), so it can take part in fractional arithmetic. Ludic has no floating point; <code>fixed</code> is how you carry sub-pixel precision for smooth movement and physics-like accumulation. Use <code>fixed</code> when you need to combine an <code>int</code> with fixed-point values or divide to get a fraction — for example <code>fixed(1) / fixed(4)</code> is <code>0.25</code>. Convert back to a whole number for drawing with <code>flr</code>.
|
||||
|
||||
Parameters:
|
||||
- `n` — the integer to lift into fixed-point
|
||||
|
||||
```ludic
|
||||
program SmoothAccumulate {
|
||||
handler ComputeStep phase Start {
|
||||
let full_speed = fixed(3)
|
||||
let half_speed = full_speed / fixed(2)
|
||||
let two_steps = half_speed + half_speed
|
||||
print(floor(two_steps))
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue