1--TEST-- 2GH-12143: Test rounding of 0.50000000000000011. 3--FILE-- 4<?php 5foreach ([ 6 0.50000000000000011, 7 -0.50000000000000011, 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.50000000000000011 -> +1 21PHP_ROUND_HALF_DOWN : +0.50000000000000011 -> +1 22PHP_ROUND_HALF_EVEN : +0.50000000000000011 -> +1 23PHP_ROUND_HALF_ODD : +0.50000000000000011 -> +1 24PHP_ROUND_HALF_UP : -0.50000000000000011 -> -1 25PHP_ROUND_HALF_DOWN : -0.50000000000000011 -> -1 26PHP_ROUND_HALF_EVEN : -0.50000000000000011 -> -1 27PHP_ROUND_HALF_ODD : -0.50000000000000011 -> -1 28