Skip to content

Bars Specification 0.1.1 — Transform: round

Category: math · Since: 0.1.0

Rounds to a number of decimal places.

Rounds the numeric input to places decimal places (0 by default), with halves rounding away from zero (matching Shopify Liquid / Ruby). A negative places is a degenerate-value soft failure.

Input coercion: number

Arguments

Name Type Optional Default
places integer yes 0

Arity: 0–1

Worked examples

{{ n | round }}

3

▶ Try it in the playground

{{ n | round: 1 }}

1.5

▶ Try it in the playground

Full fixture: transforms/transform-round.json