From ef12785e5aa3ad82b079d0103c941470003cc970 Mon Sep 17 00:00:00 2001 From: Sherif Ramadan Date: Sun, 2 Dec 2012 07:17:13 +0000 Subject: [PATCH] Added description for mode constants and an example to clarify further on the behavior of the different modes. Fixes bug #63568. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328606 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/math/functions/round.xml | 79 ++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/reference/math/functions/round.xml b/reference/math/functions/round.xml index e9743a9203..bed0ef67d8 100644 --- a/reference/math/functions/round.xml +++ b/reference/math/functions/round.xml @@ -69,10 +69,47 @@ mode - One of PHP_ROUND_HALF_UP, - PHP_ROUND_HALF_DOWN, - PHP_ROUND_HALF_EVEN, or - PHP_ROUND_HALF_ODD. + Use one of the following constants to specify the mode in which rounding occurs. + + + + + Constant + &Description; + + + + + PHP_ROUND_HALF_UP + + Round val up to precision decimal places + away from zero, when it is half way there. Making 1.5 into 2 and -1.5 into -2. + + + + PHP_ROUND_HALF_DOWN + + Round val down to precision decimal places + towards zero, when it is half way there. Making 1.5 into 2 and -1.5 into -2. + + + + PHP_ROUND_HALF_EVEN + + Round val to precision decimal places + towards the next even value. + + + + PHP_ROUND_HALF_ODD + + Round val to precision decimal places + towards the next odd value. + + + + + @@ -122,6 +159,38 @@ echo round(8.5, 0, PHP_ROUND_HALF_DOWN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_EVEN); // 8 echo round(8.5, 0, PHP_ROUND_HALF_ODD); // 9 ?> +]]> + + + + <parameter>mode with precision</parameter> examples + + ]]> @@ -189,4 +258,4 @@ End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> +--> \ No newline at end of file