You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference/forms/types/options/rounding_mode.rst.inc
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,26 @@ If a submitted number needs to be rounded (based on the `scale`_
7
7
option), you have several configurable options for that rounding. Each
8
8
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
9
9
10
-
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
10
+
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero. It
11
+
rounds ``1.4`` to ``1`` and ``-1.4`` to ``-1``.
11
12
12
-
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative infinity.
13
+
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
14
+
infinity. It rounds ``1.4`` to ``1`` and ``-1.4`` to ``-2``.
13
15
14
-
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
16
+
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero. It
17
+
rounds ``1.4`` to ``2`` and ``-1.4`` to ``-2``.
15
18
16
-
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards positive infinity.
19
+
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards positive
20
+
infinity. It rounds ``1.4`` to ``2`` and ``-1.4`` to ``-1``.
17
21
18
-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round down.
22
+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
23
+
"nearest neighbor". If both neighbors are equidistant, round down. It rounds
24
+
``2.5`` and ``1.6`` to ``2``, ``1.5`` and ``1.4`` to ``1``.
19
25
20
-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the "nearest neighbor". If both neighbors are equidistant, round towards the even neighbor.
26
+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
27
+
"nearest neighbor". If both neighbors are equidistant, round towards the even
28
+
neighbor. It rounds ``2.5``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
21
29
22
-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the "nearest neighbor". If both neighbors are equidistant, round up.
30
+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
31
+
"nearest neighbor". If both neighbors are equidistant, round up. It rounds
32
+
``2.5`` to ``3``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
0 commit comments