math

math

Mathematical helper functions over signed 32-bit integers.

This module is small on purpose — i32 operators cover most of what user code needs day-to-day. The wrappers here exist so users can write math.abs(x) instead of inlining branches everywhere.

Items

  • fn abs — Returns the absolute value of an integer.
  • fn min — Returns the smaller of a and b. See also max and clamp.
  • fn max — Returns the larger of a and b. See also min and clamp.
  • fn clamp — Clamps x into the inclusive range [lo, hi]. Equivalent to

Chapters