Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / twig / twig / doc / filters / round.rst
1 ``round``
2 =========
3
4 .. versionadded:: 1.15.0
5     The ``round`` filter was added in Twig 1.15.0.
6
7 The ``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
17 The ``round`` filter takes two optional arguments; the first one specifies the
18 precision (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
33 Arguments
34 ---------
35
36 * ``precision``: The rounding precision
37 * ``method``: The rounding method