ID: 47418 User updated by: cu19 at gmx dot de Reported By: cu19 at gmx dot de Status: Open Bug Type: *Math Functions Operating System: WinXP SP3 PHP Version: 5.3CVS-2009-02-17 (CVS) New Comment:
In fact the result is 3.8: 9.8: was a typo Previous Comments: ------------------------------------------------------------------------ [2009-02-17 09:45:57] cu19 at gmx dot de Description: ------------ In my script im using number_format to format values read from a MSSQL-DB via ODBC. Works fine, as long as the value is not equal to 1.9, 2.9, 3.9, 1.7 and probably some others. I've made the following test script: <?php echo number_format(3.9, 2); ?> Output is expected to be 3.90, but in fact is 9.8: I don't know where this colon does come from, but for me it seems to be an error in number_format. Using sprintf('%4.2f', 3.9) leads to the same problem. I'm using PHP 5.2.8 on Apache 2.2.9 on Windows XP MCE SP3. When Apache just got restarted, the test script works fine, but when executing my (quite large) script with several ODBC queries, it produces this error and after execution also the test script fails. I've tried using 5.3 snapshot and 5.2.8 snap, the error occurs also. With PHP 5.2.6, the error didn't occur as far as I can remember. The error doesn't occur, too, with CLI. Any idea? Or is it about the Apache webserver? Reproduce code: --------------- echo number_format(3.9, 2); Expected result: ---------------- 3.90 Actual result: -------------- 3.8: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47418&edit=1