|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23435 number_format works badly
Submitted: 2003-05-01 04:37 UTC Modified: 2003-05-01 04:56 UTC
From: marcin at gasnace dot slonca dot net Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.3.1 OS: Slackware Linux 8.1 kernel2.4.20
Private report: No CVE-ID: None
 [2003-05-01 04:37 UTC] marcin at gasnace dot slonca dot net
i've got a script:

echo number_format("4.705",2,'.','');
echo "<br>";
echo number_format("1.785",2,'.','');

the result should be:

1.79 (because last digit is 5)

but is

1.78 <-- why?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-01 04:56 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

This has to do with float rounding guidelines, not a bug in PHP.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 20:01:32 2024 UTC