From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.1.2 PHP Bug Type: Strings related Bug description: wrong number of decimal digits with %e specifier in sprintf
Description: ------------ Format specifier %e (scientific number) in sprintf() function gives results with wrong number of decimal digits and in one particular case it gives a mess. Reproduce code: --------------- echo sprintf("%e\n", 1.123456789); echo sprintf("%.10e\n", 1.123456789); echo sprintf("%.0e\n", 1.123456789); // this gives a mess echo sprintf("%.1e\n", 1.123456789); echo sprintf("%5.1e\n", 1.123456789); Expected result: ---------------- 1.123457e+0 1.1234567890e+0 1e+0 1.1e+0 1.1e+0 Actual result: -------------- 1.12346e+0 1.123456789e+0 .0e+0123456789 1.e+0 1.e+0 -- Edit bug report at http://bugs.php.net/?id=36392&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36392&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36392&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36392&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36392&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36392&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36392&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36392&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36392&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36392&r=support Expected behavior: http://bugs.php.net/fix.php?id=36392&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36392&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36392&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36392&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36392&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36392&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36392&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36392&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36392&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36392&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36392&r=mysqlcfg