Bug #51480 [NEW]: Error on calculation 100.2 - 100.1 - 0.1
| From: | vinilazev at gmail dot com | Date: | Mon, 05 Apr 2010 14:43:29 +0000 |
| Subject: | Bug #51480 [NEW]: Error on calculation 100.2 - 100.1 - 0.1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-149324@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: Irrelevant
Package: Math related
Bug Type: Bug
Bug description:Error on calculation 100.2 - 100.1 - 0.1
Description:
------------
Error on a simple calculation.
The correct result must be zero.
Google and JavaScript are wrong too.
But OpenOffice Calc and GCalcTool (gnome calculator) are correct.
Test script:
---------------
//Try a simple calculation:
$result = 100.2 - 100.1 - 0.1;
echo $result;
//The result is 8.520961714E-15
//And trying (inverting):
$result = 100.2 - 0.1 - 100.1;
echo $result;
//The result is 1.42108547152E-14
Expected result:
----------------
The correct result must be zero!
Actual result:
--------------
8.520961714E-15 and 1.42108547152E-14 respectively.
--
Edit bug report at http://bugs.php.net/bug.php?id=51480&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51480&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51480&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51480&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51480&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51480&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51480&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51480&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51480&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51480&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51480&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51480&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51480&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51480&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51480&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51480&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51480&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51480&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51480&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51480&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51480&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51480&r=mysqlcfg