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>
868 B
868 B
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| math-floor | Math.floor | math | namespace-method | Math.floor | Math.floor(x) -> int | Round a fixed value down to the nearest whole int. | 5 | Math | floor |
Takes a fixed value and returns the largest int not greater than it — rounding toward negative infinity, so Math.floor(2.7) is 2 and Math.floor(-0.2) is -1. This is the fixed-to-int conversion you reach for when turning a smooth position into a whole tile or pixel index. It is the same operation as the bare floor(x).
Parameters:
x— thefixedvalue to round down
program TileIndex {
const TILE_SIZE: fixed = 16.0
var world_x: fixed = 40.5
handler Locate phase Update {
let column = Math.floor(world_x / TILE_SIZE) # 2
}
}