1``round``
2=========
3
4.. versionadded:: 1.15.0
5    The ``round`` filter was added in Twig 1.15.0.
6
7The ``round`` filter rounds a number to a given precision:
8
9.. code-block:: jinja
10
11    {{ 42.55|round }}
12    {# outputs 43 #}
13
14    {{ 42.55|round(1, 'floor') }}
15    {# outputs 42.5 #}
16
17The ``round`` filter takes two optional arguments; the first one specifies the
18precision (default is ``0``) and the second the rounding method (default is
19``common``):
20
21* ``common`` rounds either up or down (rounds the value up to precision decimal
22  places away from zero, when it is half way there -- making 1.5 into 2 and
23  -1.5 into -2);
24
25* ``ceil`` always rounds up;
26
27* ``floor`` always rounds down.
28
29.. note::
30
31    The ``//`` operator is equivalent to ``|round(0, 'floor')``.
32
33Arguments
34---------
35
36* ``precision``: The rounding precision
37* ``method``: The rounding method
38