php.net |  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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marcin at gasnace dot slonca dot net
New email:
PHP Version: OS:

 

 [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:

4.71
1.79 (because last digit is 5)

but is

4.71
1.78 <-- why?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

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: Thu Mar 28 12:01:27 2024 UTC