From 7ef42bf1fc6480ea575aedc39ec6fa7e6cb1062b Mon Sep 17 00:00:00 2001 From: Tobias Perschon Date: Fri, 22 Nov 2019 19:45:42 +0100 Subject: [PATCH] clarification of round modes (#11257) --- source/_docs/configuration/templating.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index 30582f817db..dde02bf7380 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -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.