#27685 [Opn->Bgs]: floating point?
| From: | abies@php.net | Date: | Thu, 25 Mar 2004 00:22:47 +0000 |
| Subject: | #27685 [Opn->Bgs]: floating point? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56785@lists.php.net to get a copy of this message | ||
ID: 27685
Updated by: abies@php.net
Reported By: ymlee at ibcenter dot co dot kr
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: linux
PHP Version: 4.3.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.
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2004-03-24 19:12:52] ymlee at ibcenter dot co dot kr
Description:
------------
$a=33.6;
$b=84.7;
$c=118.3;
$d=$a+$b-$c;
echo $d;
the answer should 0.
but result is 1.4210854715202E-14.
it is strange!!!
Reproduce code:
---------------
$a=33.6;
$b=84.7;
$c=118.3;
$d=$a+$b-$c;
echo $d;
Expected result:
----------------
0
Actual result:
--------------
1.4210854715202E-14
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27685&edit=1