|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60528 EG(precision) affects round function's behavior
Submitted: 2011-12-15 03:03 UTC Modified: 2011-12-15 10:11 UTC
From: Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
 [2011-12-15 03:03 UTC]
as doc said:
   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);'

php -dprecision=20 -r 'echo round(1.22, 2);'

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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-15 09:55 UTC] 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 10:11 UTC]
hmm, seems you are right,  I should close this.
 [2011-12-15 10:11 UTC]
-Status: Open +Status: Bogus
 [2011-12-15 10:11 UTC]
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 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.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 04:01:34 2024 UTC