Skip to content

Conformance Examples 0.1.0 — Transforms: transform-floor

floor-rounds-down

floor rounds a positive decimal down to the previous integer via {{ n | floor }}.

Template

{{ n | floor }}

Context

{
    "n": 1.8
}

Output

1

floor-negative-decimal

floor of a negative decimal rounds away from zero.

Template

{{ n | floor }}

Context

{
    "n": -1.2
}

Output

-2

floor-integer-unchanged

floor of an integer is unchanged.

Template

{{ n | floor }}

Context

{
    "n": 5
}

Output

5

floor-non-numeric-input-is-null

A non-numeric input is a soft failure, so floor yields null.

Template

{{ n | floor }}

Context

{
    "n": "x"
}

Output

null

Source fixture: transforms/transform-floor.json