#27744 [Opn->Bgs]: 141.23 - 141.00 = 0.22999999999999 ?
| From: | alan_k@php.net | Date: | Mon, 29 Mar 2004 06:06:47 +0000 |
| Subject: | #27744 [Opn->Bgs]: 141.23 - 141.00 = 0.22999999999999 ? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56999@lists.php.net to get a copy of this message | ||
ID: 27744
Updated by: alan_k@php.net
Reported By: t dot steve at ariadne-quatra dot com
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Windows 2000 Server SP4
PHP Version: 5.0.0RC1
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.
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2004-03-29 01:05:32] t dot steve at ariadne-quatra dot com
Description:
------------
Subtraction does not work as expected.
Windows 2000 Server
SP4
IIS5
PHP5RC1
Reproduce code:
---------------
$result=141.23-141.00;
echo $result;
(or
$result=141.23-141;
echo $result;
- same result)
Expected result:
----------------
0.23
Actual result:
--------------
0.22999999999999
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27744&edit=1