Skip to main content

fmt.fmt_int

fmt.fmt_int(
    quantity,
    unit=None,
    commas=True,
    prefix='',
    suffix='',
    approx=False,
    lower_bound=False,
    upper_bound=False,
)

Format a value as an integer for narrative text.

Explicit source-level opt-in for integer display of computed values. Rounds half away from zero (2.5 → 3, -2.5 → -3) and delegates to fmt(..., precision=0, ...) so commas and approx markers still apply.

Safety: a nonzero value that would round to 0 raises instead of silently rendering as zero (same contract as fmt’s precision guard).

Back to top