#32518 [NEW]: number_format returns -0,00

From: Date: Thu, 31 Mar 2005 14:44:48 +0000
Subject: #32518 [NEW]: number_format returns -0,00
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76119@lists.php.net to get a copy of this message
From: php at mijav dot dk Operating system: FreeBSD PHP version: 4.3.9 PHP Bug Type: Math related Bug description: number_format returns -0,00 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 bug report at http://bugs.php.net/?id=32518&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32518&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32518&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32518&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32518&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32518&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32518&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32518&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32518&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32518&r=support Expected behavior: http://bugs.php.net/fix.php?id=32518&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32518&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32518&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32518&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32518&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32518&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32518&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32518&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32518&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32518&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32518&r=mysqlcfg

« previous php.bugs (#76119) next »