#21801 [Opn->Csd]: number_format do not round correctly
| From: | iliaa@php.net | Date: | Tue, 21 Jan 2003 20:10:57 +0000 |
| Subject: | #21801 [Opn->Csd]: number_format do not round correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30860@lists.php.net to get a copy of this message | ||
ID: 21801
Updated by: iliaa@php.net
Reported By: supad@noos.fr
-Status: Open
+Status: Closed
Bug Type: *Math Functions
Operating System: Linux
PHP Version: 4.2.2
New Comment:
In 4.3 both round() and number_format() round 0.5 to 1. Keep in mind
that this may also depend on your libc, which is what doing the
rounding.
Previous Comments:
------------------------------------------------------------------------
[2003-01-21 12:38:38] supad@noos.fr
<?
echo number_format(0.49)."<br>";
echo number_format(0.50)."<br>";
echo number_format(0.51)."<br><br>";
echo round(0.49)."<br>";
echo round(0.50)."<br>";
echo round(0.51)."<br>";
?>
returns
0
0
1
0
1
1
number_format do not round correctly while round does.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21801&edit=1