ID: 22802 User updated by: php at ken dot guest dot cx Reported By: php at ken dot guest dot cx -Status: Bogus +Status: Open Bug Type: *Math Functions Operating System: FreeBSD PHP Version: 4.3.0 New Comment:
I asked it to round 29.999 (as stored in variable $i) to 2 digits of precision and was expecting to get 29.99... reopening Previous Comments: ------------------------------------------------------------------------ [2003-03-20 05:50:33] php at ken dot guest dot cx also: $ php -r 'echo round(29.99, 2), "\n";' 29.99 $ php -r 'echo round(29.9999, 2), "\n";' 30 these should both pring 29.99 ------------------------------------------------------------------------ [2003-03-20 04:44:02] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php you asked it to round and so it did ------------------------------------------------------------------------ [2003-03-20 04:25:26] php at ken dot guest dot cx in short these should all pring 29.99. they don't: <?php $discountrate = 10; $i = 299.99/100 * $discountrate; echo "$i\n"; echo sprintf("%.2f",$i), "\n"; echo round($i, 2), "\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22802&edit=1