#38300 [Opn->Bgs]: equation result error
| From: | tony2001@php.net | Date: | Wed, 02 Aug 2006 22:34:36 +0000 |
| Subject: | #38300 [Opn->Bgs]: equation result error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100250@lists.php.net to get a copy of this message | ||
ID: 38300
Updated by: tony2001@php.net
Reported By: rogergg at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *Compile Issues
Operating System: linux/windows
PHP Version: 5.1.4
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2006-08-02 22:28:18] rogergg at gmail dot com
Description:
------------
the result for $a is 40 exactly.
you can check it but i donk know why the if choosed that it is
different. the problem is with the result that this take from the
equation. if you print the result this show 40 but if you compare this
with 40 say that is different
thanks for all
Reproduce code:
---------------
<?
$a=((1899-1139.4)*100)/1899;
if($a==40)
echo "is good $a";
else
echo"is bad $a";
?>
Expected result:
----------------
is good 40
Actual result:
--------------
is bad 40
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38300&edit=1