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