#31180 [Bgs]: 4.3.10 printf(%.2f) precision bug.
ID: 31180 User updated by: patrick at ilmander dot com Reported By: patrick at ilmander dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: Red Hat Linux PHP Version: 4.3.10 New Comment: I'm sorry, I should have given you more details. The problem doesn't seem to be printf() itself, but where I used it. I was using the following code: Rating: b?=printf(%.2f, $rating)?/b which worked fine in 4.3.4, but when we upgraded to 4.3.10 it produced the stated error. I've updated all my code to Rating: b?php printf(%.2f, $rating)?/b which works fine. I probably shouldn't have used printf() inside a ?= ? in the first place, but it worked fine in 4.3.4 and not in 4.3.10, that's why I reported it as a bug. Sorry for wasting your time. // Patrick Previous Comments: [2004-12-19 19:18:44] [EMAIL PROTECTED] works fine. [2004-12-19 16:54:24] postings-php-bug at hans-spath dot de I've tried it under PHP 4.3.10/Linux 2.6 and PHP 4.3.8/WinXPsp2, works as it should. Could you test with _%.2f_, just to get sure the last digit isn't coming from somewhere else in your code? [2004-12-18 23:43:48] [EMAIL PROTECTED] This works fine here: $ php-4.3dev -r 'echo sprintf(%.2f, 42.1231213123);' 42.12 [2004-12-18 12:20:20] patrick at ilmander dot com Printing a variable with %.2f should output the number with 2 decimals. After upgrading to 4.3.10 it now outputs 3 decimals. %.1f outputs with 2 decimals and I haven't figured out how to print out just 1 decimal (%.0f doesn't work), so I'm treating this as a bug. [2004-12-18 12:18:54] patrick at ilmander dot com Description: Printing a variable with %.2f should output the number with 2 decimals. After upgrading to 4.3.10 it now outputs 3 decimals. %.1f outputs with 2 decimals and I haven't figured out how to print out just 1 decimal (%.1f doesn't work), so I'm treating this as a bug. Reproduce code: --- printf(%.2f, $member[score] / $member[votes]); Expected result: 1.23 Actual result: -- 1.234 -- Edit this bug report at http://bugs.php.net/?id=31180edit=1
#31180 [NEW]: 4.3.10 printf(%.2f) precision bug.
From: patrick at ilmander dot com Operating system: Red Hat Linux PHP version: 4.3.10 PHP Bug Type: Unknown/Other Function Bug description: 4.3.10 printf(%.2f) precision bug. Description: Printing a variable with %.2f should output the number with 2 decimals. After upgrading to 4.3.10 it now outputs 3 decimals. %.1f outputs with 2 decimals and I haven't figured out how to print out just 1 decimal (%.1f doesn't work), so I'm treating this as a bug. Reproduce code: --- printf(%.2f, $member[score] / $member[votes]); Expected result: 1.23 Actual result: -- 1.234 -- Edit bug report at http://bugs.php.net/?id=31180edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31180r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31180r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31180r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=31180r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=31180r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31180r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31180r=needscript Try newer version: http://bugs.php.net/fix.php?id=31180r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31180r=support Expected behavior: http://bugs.php.net/fix.php?id=31180r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31180r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31180r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=31180r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31180r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=31180r=dst IIS Stability: http://bugs.php.net/fix.php?id=31180r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31180r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31180r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31180r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31180r=mysqlcfg
#31180 [Opn]: 4.3.10 printf(%.2f) precision bug.
ID: 31180 User updated by: patrick at ilmander dot com Reported By: patrick at ilmander dot com Status: Open Bug Type: Unknown/Other Function Operating System: Red Hat Linux PHP Version: 4.3.10 New Comment: Printing a variable with %.2f should output the number with 2 decimals. After upgrading to 4.3.10 it now outputs 3 decimals. %.1f outputs with 2 decimals and I haven't figured out how to print out just 1 decimal (%.0f doesn't work), so I'm treating this as a bug. Previous Comments: [2004-12-18 12:18:54] patrick at ilmander dot com Description: Printing a variable with %.2f should output the number with 2 decimals. After upgrading to 4.3.10 it now outputs 3 decimals. %.1f outputs with 2 decimals and I haven't figured out how to print out just 1 decimal (%.1f doesn't work), so I'm treating this as a bug. Reproduce code: --- printf(%.2f, $member[score] / $member[votes]); Expected result: 1.23 Actual result: -- 1.234 -- Edit this bug report at http://bugs.php.net/?id=31180edit=1