#24891 [Opn->Bgs]: Decimal equality incorrect result
| From: | sniper@php.net | Date: | Thu, 31 Jul 2003 18:35:14 +0000 |
| Subject: | #24891 [Opn->Bgs]: Decimal equality incorrect result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45128@lists.php.net to get a copy of this message | ||
ID: 24891
Updated by: sniper@php.net
Reported By: jeff at tmtrading dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Win2000 & RH Linux 8.0
PHP Version: 4CVS-2003-07-31 (stable)
New Comment:
RTFM:
http://fi2.php.net/manual/en/language.types.float.php
Previous Comments:
------------------------------------------------------------------------
[2003-07-31 13:32:22] jeff at tmtrading dot com
Description:
------------
When I try to test equality using these numbers php incorrectly returns
false. This is a serious problem as we are developing a e-cart in php.
Reproduce code:
---------------
$all = 0.92;
$asum = 0.71;
$bsum = 0.21;
if($all == ($asum + $bsum)) {
print "TRUE\n";
} else {
print "FALSE\n";
}
Expected result:
----------------
TRUE
Actual result:
--------------
FALSE
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24891&edit=1