|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73581 number_format allows for -0.00
Submitted: 2016-11-22 15:30 UTC Modified: 2017-01-08 17:19 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bowersbros at gmail dot com Assigned:
Status: Wont fix Package: Math related
PHP Version: Irrelevant OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bowersbros at gmail dot com
New email:
PHP Version: OS:


 [2016-11-22 15:30 UTC] bowersbros at gmail dot com
number_format fixes the number output from many decimals to a defined number. 

If you were to have a sufficiently small negative number, it will round and display "-0.00". I'd expect it to become zero, 

This has already been reported at however that is 13 years ago and it has not received a response.

Test script:


$number = -1.15E-15;

var_dump(number_format($number, 2));

Expected result:

Actual result:


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-22 15:31 UTC] bowersbros at gmail dot com
-Package: *General Issues +Package: Math related
 [2016-11-22 15:31 UTC] bowersbros at gmail dot com
Changed to be math
 [2017-01-08 17:19 UTC]
-Status: Open +Status: Wont fix
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 16 00:01:23 2021 UTC