#44311 [NEW]: Bug in arithmetic operation: 173.42-173.42=2.8421709430404E-014
| From: | sawas at poczta dot onet dot pl | Date: | Sun, 02 Mar 2008 13:25:44 +0000 |
| Subject: | #44311 [NEW]: Bug in arithmetic operation: 173.42-173.42=2.8421709430404E-014 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-122840@lists.php.net to get a copy of this message | ||
From: sawas at poczta dot onet dot pl
Operating system: WinXP, Debian
PHP version: 4.4.8
PHP Bug Type: Math related
Bug description: Bug in arithmetic operation: 173.42-173.42=2.8421709430404E-014
Description:
------------
I found a bug in arithmetic operation.
Simple subtraction of amounts gives inaccurate result.
Reproduce code:
---------------
$a = 160.00 + 5.90 + 7.52;
$b = 173.42;
print $a-$b;
Expected result:
----------------
0
Actual result:
--------------
2.8421709430404E-014
--
Edit bug report at http://bugs.php.net/?id=44311&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44311&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44311&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44311&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44311&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44311&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44311&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44311&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44311&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44311&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44311&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44311&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44311&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44311&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44311&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44311&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44311&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44311&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44311&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44311&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44311&r=mysqlcfg