|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-11 15:25 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 12:00:02 2026 UTC |
Description: ------------ There is a problem with formatting float output for 0.28 values. Check it out. Reproduce code: --------------- <?php for($i=1;$i<=10000;$i++) { $a = round($i/100,2); if (sprintf("%d",$a*100) != $i) echo sprintf("$i -> %d<br>",$a*100); } ?> Expected result: ---------------- I would expect no output at all Actual result: -------------- 29 -> 28 57 -> 56 58 -> 57 113 -> 112 114 -> 113 115 -> 114 116 -> 115 201 -> 200 203 -> 202 205 -> 204 207 -> 206 226 -> 225 228 -> 227 230 -> 229 232 -> 231 251 -> 250 253 -> 252 255 -> 254 402 -> 401 406 -> 405 410 -> 409 414 -> 413 427 -> 426 431 -> 430 435 -> 434 439 -> 438 452 -> 451 456 -> 455 460 -> 459 464 -> 463 477 -> 476 481 -> 480 485 -> 484 489 -> 488 ... ... 8160 -> 8159 8171 -> 8170 8174 -> 8173 8182 -> 8181 8185 -> 8184