#24365 [Opn->Bgs]: Result problem with soustractions
| From: | sniper@php.net | Date: | Fri, 27 Jun 2003 22:35:54 +0000 |
| Subject: | #24365 [Opn->Bgs]: Result problem with soustractions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42654@lists.php.net to get a copy of this message | ||
ID: 24365
Updated by: sniper@php.net
Reported By: jump at worldakt dot com
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 4.3.2
New Comment:
..
Previous Comments:
------------------------------------------------------------------------
[2003-06-27 14:14:38] marcot at tabini dot ca
This is not really a bug. It's due to normal fluctuations in the way
floating-point numbers are handled by the C libraries. Here's another
example of this behaviour:
http://bugs.php.net/bug.php?id=22333
You may also want to check out this bit on IEEE representation of
floating-point number to understand why some numbers cannot be
represented:
http://www.psc.edu/general/software/packages/ieee/ieee.html
------------------------------------------------------------------------
[2003-06-27 13:22:54] jump at worldakt dot com
Description:
------------
It seems that when I soustract something (float) it returns a wrong
result.
Reproduce code:
---------------
<?php
echo 290.34 - (142.00 + 148.34);
?>
-5.68434188608E-14
<?php
echo 142.00 + 148.34;
?>
290.34
<?php
echo 290.34 - 290.34;
?>
0
Expected result:
----------------
<?php
echo 290.34 - (142.00 + 148.34);
?>
0
Actual result:
--------------
<?php
echo 290.34 - (142.00 + 148.34);
?>
-5.68434188608E-14
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24365&edit=1