8000 Added some examples to rounding options · symfony/symfony-docs@2cf1cff · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cf1cff

Browse files
committed
Added some examples to rounding options
1 parent 1af55e6 commit 2cf1cff

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

reference/forms/types/options/rounding_mode.rst.inc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,26 @@ If a submitted number needs to be rounded (based on the `scale`_
77
option), you have several configurable options for that rounding. Each
88
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
99

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``.
1112

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``.
1315

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``.
1518

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``.
1721

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``.
1925

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``.
2129

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

Comments
 (0)
0