#31180 [NEW]: 4.3.10 printf(%.2f) precision bug.
| From: | patrick at ilmander dot com | Date: | Sat, 18 Dec 2004 11:18:55 +0000 |
| Subject: | #31180 [NEW]: 4.3.10 printf(%.2f) precision bug. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70593@lists.php.net to get a copy of this message | ||
From: patrick at ilmander dot com
Operating system: Red Hat Linux
PHP version: 4.3.10
PHP Bug Type: Unknown/Other Function
Bug description: 4.3.10 printf(%.2f) precision bug.
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 bug report at http://bugs.php.net/?id=31180&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31180&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31180&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31180&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31180&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31180&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31180&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31180&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31180&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31180&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31180&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31180&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31180&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31180&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31180&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31180&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31180&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31180&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31180&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31180&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31180&r=mysqlcfg