---
id: math-floor
name: Math.floor
category: math
kind: namespace-method
tokens: Math.floor
sig: Math.floor(x) -> int
tip: Round a fixed value down to the nearest whole int.
order: 5
ns: Math
member: 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` — the `fixed` value to round down
```ludic
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
}
}
```