|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-02 17:51 UTC] aldo at totalaldo dot com
Description:
------------
php -r 'echo sprintf("%6d", 34.98*100);'
output: 3497
Reproduce code:
---------------
php -r 'echo sprintf("%6d", 34.98*100);'
Expected result:
----------------
3498
Actual result:
--------------
3497
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 23 19:00:01 2026 UTC |
Thank you for your prompt reply. I was aware of the limitations of Floating point representations.. Hopefully, anyone using similar code will now use another technique. php -r 'echo sprintf("%6s", 34.98*100);' outputs the expected result of 3498.