From: tjouanne at hotmail dot com
Operating system: Linux and windows
PHP version: 4.4.4
PHP Bug Type: *General Issues
Bug description: Round() function strange issue
Description:
------------
round number with round() function give strange result:
9.815,609.815,4690.815,14609.815,6.735,56.735,1056.735,11056.735
produce
9.82
609.82
4609.81
14609.82
6.74
56.74
1056.73
11056.74
Why it's become 81 or 73 instead of 82 or 74
Reproduce code:
---------------
<?
echo (round("9.815", 2)."<BR>");
echo (round("609.815", 2)."<BR>");
echo (round("4609.815", 2)."<BR>");
echo (round("14609.815", 2)."<BR>");
echo (round("6.735", 2)."<BR>");
echo (round("56.735", 2)."<BR>");
echo (round("1056.735", 2)."<BR>");
echo (round("11056.735", 2)."<BR>");
?>
Expected result:
----------------
9.82
609.82
4609.82
14609.82
6.74
56.74
1056.74
11056.74
Actual result:
--------------
9.82
609.82
4609.81
14609.82
6.74
56.74
1056.73
11056.74
--
Edit bug report at http://bugs.php.net/?id=40304&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40304&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40304&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40304&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40304&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40304&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40304&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40304&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40304&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40304&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40304&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40304&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40304&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40304&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40304&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40304&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40304&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40304&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40304&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40304&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40304&r=mysqlcfg