Bug #70559 [Opn->Nab]: subtraction float numbers bug
| From: | ab@php.net | Date: | Wed, 23 Sep 2015 12:24:34 +0000 |
| Subject: | Bug #70559 [Opn->Nab]: subtraction float numbers bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196183@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70559&edit=1
ID: 70559
Updated by: ab@php.net
Reported by: jakub dot trzcinski at valueadd dot pl
Summary: subtraction float numbers bug
-Status: Open
+Status: Not a bug
Type: Bug
Package: Math related
Operating System: Windows And Linux
PHP Version: 5.6.13
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Floating point numbers have limited precision. Often it's like 7 significant places on 32-bit
and 15 on 64-bit. It is platform dependent. What you experience is therefore expected behavior.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2015-09-23 11:11:43] jakub dot trzcinski at valueadd dot pl
Description:
------------
it's doesnt matter which is type(int/float) of seccond value, its always bad result.
Test script:
---------------
$a = 217.80;
$b = 217;
echo $a - $b;
------------------------
$a = 217.80;
$b = 217.00;
echo $a - $b;
Expected result:
----------------
0.8
Actual result:
--------------
0.80000000000001
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70559&edit=1