From: lbayuk at pobox dot com Operating system: Linux PHP version: 5.2.6 PHP Bug Type: Unknown/Other Function Bug description: printf %e format should make 2 digit exponent
Description: ------------ PHP printf, sprintf, and fprintf with %e scientific notation produce a 1 digit exponent for values less than 1e10. Other implementation of functions by the same name produce a minimum of 2 digits in the exponent, as the C standard requires. Although it can be argued that PHP is not bound by other standards, the following comment in main/snprintf.c function php_conv_fp() [line 545] leads one to believe this is a PHP bug: /* * Make sure the exponent has at least 2 digits */ Reproduce code: --------------- <?php printf("%8.2e\n", 1000000); Expected result: ---------------- 1.00e+06 Actual result: -------------- <space>1.00e+6 -- Edit bug report at http://bugs.php.net/?id=46145&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46145&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46145&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46145&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46145&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46145&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46145&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46145&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46145&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46145&r=support Expected behavior: http://bugs.php.net/fix.php?id=46145&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46145&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46145&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46145&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46145&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46145&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46145&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46145&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46145&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46145&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46145&r=mysqlcfg