pub fn round(
value: Value,
precision: Option<i32>,
method: Option<&str>,
kwargs: Kwargs,
) -> Result<Value, Error>Expand description
Round the number to a given precision.
The first parameter specifies the precision (default is 0), the second the rounding method:
commonrounds half to even (default)ceilalways rounds upflooralways rounds down
Both can also be passed as keyword arguments. Integers are returned unchanged unless the precision is negative.
{{ 42.55|round }}
-> 43.0
{{ 42.55|round(1, "floor") }}
-> 42.5
{{ 42.15|round(method="ceil") }}
-> 43.0
{{ 1234|round(-2) }}
-> 1200