note 49254 added to function.sprintf
| From: | jrpozoatconclasedotnet at osu1 dot php dot net | Date: | Fri, 21 Jan 2005 15:13:19 +0000 |
| Subject: | note 49254 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83732@lists.php.net to get a copy of this message | ||
Be careful if you use the %f modifier to round decimal numbers as it (starting from 4.3.10) will no
longer produce a float number if you set certain locales, so you can't accumulate the result.
For example:
setlocale(LC_ALL, 'es_ES');
echo(sprintf("%.2f", 13.332) + sprintf("%.2f", 14.446))
gives 27 instead of 27.78, so use %F instead.
----
Manual Page -- http://www.php.net/manual/en/function.sprintf.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49254
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49254&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49254&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49254&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49254&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49254&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49254&report=yes
Search -- http://master.php.net/manage/user-notes.php