clarification of round modes (#11257)

This commit is contained in:
Tobias Perschon 2019-11-22 19:45:42 +01:00 committed by Franck Nijhof
parent d4039eb21a
commit 7ef42bf1fc

View File

@ -325,7 +325,10 @@ Some of these functions can also be used in a [filter](https://jinja.palletsproj
- `e` mathematical constant, approximately 2.71828.
- `pi` mathematical constant, approximately 3.14159.
- `tau` mathematical constant, approximately 6.28318.
- Filter `round(x)` will convert the input to a number and round it to `x` decimals.
- Filter `round(x)` will convert the input to a number and round it to `x` decimals. Round has four modes and the default mode (with no mode specified) will [round-to-even](https://en.wikipedia.org/wiki/Rounding#Roundhalfto_even).
- `round(x, "floor")` will always round down to `x` decimals
- `round(x, "ceil")` will always round up to `x` decimals
- `round(1, "half")` will always round to the nearest .5 value. `x` should be 1 for this mode
- Filter `max` will obtain the largest item in a sequence.
- Filter `min` will obtain the smallest item in a sequence.
- Filter `value_one|bitwise_and(value_two)` perform a bitwise and(&) operation with two values.