#46272 [Opn->Fbk]: invalid numbers returned
| From: | felipe@php.net | Date: | Fri, 10 Oct 2008 18:41:18 +0000 |
| Subject: | #46272 [Opn->Fbk]: invalid numbers returned | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129611@lists.php.net to get a copy of this message | ||
ID: 46272
Updated by: felipe@php.net
Reported By: chris at corecoding dot com
-Status: Open
+Status: Feedback
Bug Type: Math related
Operating System: Multiple: Debian and Mac OS X
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2008-10-10 18:39:23] chris at corecoding dot com
Description:
------------
Both results should be 0. They are not!
Reproduce code:
---------------
$total = 2291.45;
$paid = 2453.425;
$tax = 161.975;
echo (($total - $paid) + $tax) . "\n";
# -3.69482222595E-13
echo (($total + $tax) - $paid) . "\n";
-4.54747350886E-13
Expected result:
----------------
0!
Actual result:
--------------
-3.69482222595E-13
and
-4.54747350886E-13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46272&edit=1