From: jortac2002 at yahoo dot com dot mx
Operating system: WINDOWS XP PROFESSIONAL
PHP version: 5.2.4
PHP Bug Type: Scripting Engine problem
Bug description: WRONG ARITMETHIC RESULT
Description:
------------
I have the following code :
It is very simple code, and the result is very stange because
amounts are the same but result shows "NOT EQUAL"
Reproduce code:
---------------
<html>
<body>
<?
$one = 1519.36;
$two = 1153.14;
$tree = 366.22;
$four = $two + $tree;
$difer = $one - $four;
echo "one " . $one . " equals four " . $four . "<br>";
if ($four == $one) {
echo "THEY ARE EQUAL <br>";
}
else {
echo "THEY ARE NOT EQUAL DIFFERENCE " . $difer . "<br>";
}
?>
</body>
</html>
Expected result:
----------------
THEY ARE EQUAL
Actual result:
--------------
THEY ARE NOT EQUAL DIFFERENCE -2.737367544323E-013
--
Edit bug report at http://bugs.php.net/?id=42628&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42628&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42628&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42628&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42628&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42628&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42628&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42628&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42628&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42628&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42628&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42628&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42628&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42628&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42628&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42628&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42628&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42628&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42628&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42628&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42628&r=mysqlcfg