diff --git a/reference/bc/bcmath/number/round.xml b/reference/bc/bcmath/number/round.xml index d1669e97d2d4..72cb2a961c37 100644 --- a/reference/bc/bcmath/number/round.xml +++ b/reference/bc/bcmath/number/round.xml @@ -25,11 +25,11 @@ - + mode - Specifies the rounding mode. + Specifies the rounding mode. For more information about modes, see RoundingMode. diff --git a/reference/bc/functions/bcround.xml b/reference/bc/functions/bcround.xml index 6ea69dc43cb9..727f1c50dd82 100644 --- a/reference/bc/functions/bcround.xml +++ b/reference/bc/functions/bcround.xml @@ -27,14 +27,7 @@ - - mode - - - Specifies the rounding mode. - - - + diff --git a/reference/math/functions/round.xml b/reference/math/functions/round.xml index a7f653005324..c1a752b3ae4a 100644 --- a/reference/math/functions/round.xml +++ b/reference/math/functions/round.xml @@ -11,7 +11,7 @@ floatround intfloatnum intprecision0 - intmodePHP_ROUND_HALF_UP + intRoundingModemodeRoundingMode::HalfAwayFromZero Returns the rounded value of num to @@ -71,7 +71,7 @@ mode - Use one of the following constants to specify the mode in which rounding occurs. + Use RoundingMode or one of the following constants to specify the mode in which rounding occurs. @@ -112,6 +112,7 @@ + However, please note that some newly added modes only exist in RoundingMode. @@ -145,6 +146,12 @@ + + 8.4.0 + + Four new rounding modes have been added. + + 8.4.0 @@ -321,6 +328,61 @@ float(-1.5) ]]> + + Example of using <enumname>RoundingMode</enumname> + + %+.17g\n", $mode->name, $number, round($number, 0, $mode)); + } + echo "\n"; +} +?> +]]> + + &example.outputs; + + +9 +HalfAwayFromZero : +9.5 -> +10 +HalfAwayFromZero : -3.5 -> -4 + +HalfTowardsZero : +8.5 -> +8 +HalfTowardsZero : +9.5 -> +9 +HalfTowardsZero : -3.5 -> -3 + +HalfEven : +8.5 -> +8 +HalfEven : +9.5 -> +10 +HalfEven : -3.5 -> -4 + +HalfOdd : +8.5 -> +9 +HalfOdd : +9.5 -> +9 +HalfOdd : -3.5 -> -3 + +TowardsZero : +8.5 -> +8 +TowardsZero : +9.5 -> +9 +TowardsZero : -3.5 -> -3 + +AwayFromZero : +8.5 -> +9 +AwayFromZero : +9.5 -> +10 +AwayFromZero : -3.5 -> -4 + +NegativeInfinity : +8.5 -> +8 +NegativeInfinity : +9.5 -> +9 +NegativeInfinity : -3.5 -> -4 + +PositiveInfinity : +8.5 -> +9 +PositiveInfinity : +9.5 -> +10 +PositiveInfinity : -3.5 -> -3 +]]> + + diff --git a/reference/math/roundingmode.xml b/reference/math/roundingmode.xml index d0db7407f1c4..b80c0da86682 100644 --- a/reference/math/roundingmode.xml +++ b/reference/math/roundingmode.xml @@ -9,7 +9,7 @@ The RoundingMode enum is used to specify how rounding should be performed for round, - bcround, and BCMath::round. + bcround, and BcMath\Number::round.