From: chris at corecoding dot com Operating system: Multiple: Debian and Mac OS X PHP version: 5.2.6 PHP Bug Type: Math related Bug description: invalid numbers returned
Description: ------------ Both results should be 0. They are not! Reproduce code: --------------- $total = 2291.45; $paid = 2453.425; $tax = 161.975; echo (($total - $paid) + $tax) . "\n"; # -3.69482222595E-13 echo (($total + $tax) - $paid) . "\n"; -4.54747350886E-13 Expected result: ---------------- 0! Actual result: -------------- -3.69482222595E-13 and -4.54747350886E-13 -- Edit bug report at http://bugs.php.net/?id=46272&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46272&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46272&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46272&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46272&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46272&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46272&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46272&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46272&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46272&r=support Expected behavior: http://bugs.php.net/fix.php?id=46272&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46272&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46272&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46272&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46272&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46272&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46272&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46272&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46272&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46272&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46272&r=mysqlcfg