ludic/docs/language/math/math-ceil.md

846 B

id name category kind tokens sig tip order ns member
math-ceil Math.ceil math namespace-method Math.ceil Math.ceil(x) -> int Round a fixed value up to the nearest whole int. 6 Math ceil

Takes a fixed value and returns the smallest int not less than it — rounding toward positive infinity, so Math.ceil(2.1) is 3 and Math.ceil(4.0) stays 4. Use it when you need to cover a fractional amount with whole units: how many full tiles a span touches, or how many rows a variable-height list needs.

Parameters:

  • x — the fixed value to round up
program RowsNeeded {
  const ROW_HEIGHT: fixed = 12.0

  let content_height: fixed = 30.0

  handler Layout phase Update {
    let rows = Math.ceil(content_height / ROW_HEIGHT)   # 3
  }
}