ID: 31180 Updated by: [EMAIL PROTECTED] Reported By: patrick at ilmander dot com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Red Hat Linux PHP Version: 4.3.10 New Comment:
works fine. Previous Comments: ------------------------------------------------------------------------ [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=31180&edit=1