Bug #60528 [Opn->Bgs]: EG(precision) affects round function's behavior
| From: | laruence@php.net | Date: | Thu, 15 Dec 2011 10:11:47 +0000 |
| Subject: | Bug #60528 [Opn->Bgs]: EG(precision) affects round function's behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165879@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60528&edit=1
ID: 60528
Updated by: laruence@php.net
Reported by: laruence@php.net
Summary: EG(precision) affects round function's behavior
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
PHP Version: 5.3.8
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.
Previous Comments:
------------------------------------------------------------------------
[2011-12-15 10:11:34] laruence@php.net
hmm, seems you are right, I should close this.
------------------------------------------------------------------------
[2011-12-15 09:55:16] bobwei9 at hotmail dot com
$ php -dprecision=20 -r 'echo 1.22;'
outputs: 1.2199999999999999734
I think it's only the floating point imprecision and not round()-specific.
------------------------------------------------------------------------
[2011-12-15 03:03:28] laruence@php.net
Description:
------------
as doc said:
precision:
The number of significant digits displayed in floating point numbers.
so precision suppose to only affect the display format of a float;
but the fact is:
$php -dprecision=14 -r 'echo round(1.22, 2);'
1.22
php -dprecision=20 -r 'echo round(1.22, 2);'
1.2199999999999999734
the eg(precision) affected the round result.
Test script:
---------------
$php -dprecision=14 -r 'echo round(1.22, 2);'
php -dprecision=20 -r 'echo round(1.22, 2);'
Expected result:
----------------
1.22
1.22
Actual result:
--------------
1.22
1.2199999999999999734
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60528&edit=1