#32518 [Opn->WFx]: number_format returns -0,00

From: Date: Sun, 03 Apr 2005 16:04:53 +0000
Subject: #32518 [Opn->WFx]: number_format returns -0,00
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76251@lists.php.net to get a copy of this message
ID: 32518 Updated by: sniper@php.net Reported By: php at mijav dot dk -Status: Open +Status: Wont fix Bug Type: Math related Operating System: * PHP Version: 4CVS, 5CVS (2005-03-31) Previous Comments: ------------------------------------------------------------------------ [2005-03-31 16:44:47] php at mijav dot dk Description: ------------ Tthe number -0,00 is non-existent and inconsistent, pointed out in a duplicate bug report, and therefore the output is jibberish. If you do a number_format(round($foo,2), 2, ",", "."); then the output will be correct/as expected. This is also why number_format should be considered buggy. If number_format rounds before formatting, it should be consistent: -0,00 isn't consistent since -0,505 gets rounded to -0,51. Please re-evaluate the situation. The output -0,00 is not useful. Please note that our production server uses 4.3.8, but the Changelog reports nothing about a fix, and the previous bug report was marked Bogus. Reproduce code: --------------- <? echo number_format(-0.0012499999998, 2, ",", "."); ?> Expected result: ---------------- 0,00 Actual result: -------------- -0,00 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32518&edit=1

« previous php.bugs (#76251) next »