From: tcarter at noggin dot com dot au Operating system: Linux PHP version: Irrelevant PHP Bug Type: Feature/Change Request Bug description: Add support for %g (significant digits) format to printf functions
Description: ------------ PHP's sprintf() (and other printf type functions) do not provide any method to specify the number of significant digits to be output, only field lengths and precision. The glibc printf (3) man page lists a 'g' conversion specifier which behaves the same as 'd' but interprets the precision field as the number of significant digits to output rather than the number of digits to place after the decimal point. Since PHP doesn't appear to have any existing built-in mechanism for formatting a value to a specified number of significant digits, I think that support for this should be added to sprintf(). -- Edit bug report at http://bugs.php.net/?id=27916&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27916&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27916&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27916&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27916&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27916&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27916&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27916&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27916&r=support Expected behavior: http://bugs.php.net/fix.php?id=27916&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27916&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27916&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27916&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27916&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27916&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27916&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27916&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27916&r=float