#28536 [NEW]: Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99

From: Date: Wed, 26 May 2004 20:04:41 +0000
Subject: #28536 [NEW]: Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-60046@lists.php.net to get a copy of this message
From: hart0550 at umn dot edu Operating system: Linux PHP version: 4.3.4 PHP Bug Type: Math related Bug description: Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99 Description: ------------ When calculating 90.99 minus 90.00 it returns 0.98999999999999 which is a bit big for a simple subtraction of two floats that only have 2 decimal numbers. Reproduce code: --------------- <?php $calc = 90.99 - 90.00; print $calc; ?> Expected result: ---------------- .99 Actual result: -------------- 0.98999999999999 -- Edit bug report at http://bugs.php.net/?id=28536&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28536&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28536&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28536&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28536&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28536&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28536&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28536&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28536&r=support Expected behavior: http://bugs.php.net/fix.php?id=28536&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28536&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28536&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28536&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28536&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28536&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28536&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28536&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28536&r=float

« previous php.bugs (#60046) next »