1--TEST-- 2GH-12143: Test rounding of 0.5. 3--FILE-- 4<?php 5foreach ([ 6 0.5, 7 -0.5, 8] as $number) { 9 foreach ([ 10 'PHP_ROUND_HALF_UP', 11 'PHP_ROUND_HALF_DOWN', 12 'PHP_ROUND_HALF_EVEN', 13 'PHP_ROUND_HALF_ODD', 14 ] as $mode) { 15 printf("%-20s: %+.17g -> %+.17g\n", $mode, $number, round($number, 0, constant($mode))); 16 } 17} 18?> 19--EXPECT-- 20PHP_ROUND_HALF_UP : +0.5 -> +1 21PHP_ROUND_HALF_DOWN : +0.5 -> +0 22PHP_ROUND_HALF_EVEN : +0.5 -> +0 23PHP_ROUND_HALF_ODD : +0.5 -> +1 24PHP_ROUND_HALF_UP : -0.5 -> -1 25PHP_ROUND_HALF_DOWN : -0.5 -> -0 26PHP_ROUND_HALF_EVEN : -0.5 -> -0 27PHP_ROUND_HALF_ODD : -0.5 -> -1 28