Skip to content

RoundingMode

RoundingMode = "ceiling" | "floor" | "up" | "down" | "half-up" | "half-down" | "half-even" | "half-odd" | "half-ceiling" | "half-floor" | "unnecessary"

Defined in: packages/math-numbers/src/rounding-mode.ts:20

Rounding mode applied when an arithmetic result cannot be represented exactly at the requested precision — a division that does not terminate, a square root, a fixed-width result that does not fit.

Eleven modes: IEEE 754-2019’s five (ceiling, floor, down, half-even, half-up), the rest of java.math.RoundingMode (up, half-down, unnecessary), and three it lacks (half-ceiling, half-floor, half-odd). unnecessary does not round at all — it signals when rounding would be needed.

This is not the mode a renderer uses. INum.format delegates to Intl.NumberFormat, whose own roundingMode covers nine of these under different names (ceiling→ceil, up→expand, down→trunc, half-up→halfExpand, half-down→halfTrunc, and the rest verbatim in camel case). The two it has no name for are the two that are not rendering decisions: unnecessary is an assertion, and half-odd appears in no formatter.