From: phpbug at billix dot franken dot de Operating system: Linux PHP version: Irrelevant PHP Bug Type: Output Control Bug description: printf("%6.2f") and values less than 1 gives wrong output
Description: ------------ A printf of float values less than 1 gives an incorrect output. It looks like the numbers before the dot equal the width specifier... This happens with every tested PHP version (4.3.7, 5.0.0RC3 and CVS) With PHP 4.3.6 both outputs were wrong... Oliver Reproduce code: --------------- $a = sprintf ( "%06.2f" , 0.5 ); $b = sprintf ( "%06.2f" , 1.5 ); var_dump($a); var_dump($b); Expected result: ---------------- string(6) "000.50" string(6) "001.50" Actual result: -------------- string(9) "000000.50" string(6) "001.50" -- Edit bug report at http://bugs.php.net/?id=28975&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28975&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28975&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28975&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28975&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28975&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28975&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28975&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28975&r=support Expected behavior: http://bugs.php.net/fix.php?id=28975&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28975&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28975&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28975&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28975&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28975&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28975&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28975&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28975&r=float