|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesSprintf-bug-for-some-values (last revision 2016-12-13 10:30 UTC by teodor dot danciu at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-12-13 10:35 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-12-13 10:35 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Description: ------------ sprintf("%03d ",(1.15*100)); and values multiplied by 2 return wrong values ex 114 instead of 115 Test script: --------------- $price=1.15*100; echo sprintf("%03d ",$price); // prints 114 instead of 115 $price=1.15*100*2; echo sprintf("%03d ",$price); // prints 229 instead of 230 $price=1.15*100*4; echo sprintf("%03d ",$price); // prints 459 instead of 460 $price=1.15*100*8; echo sprintf("%03d ",$price); // prints 919 instead of 920 $price=1.15*100*10; echo sprintf("%03d ",$price); // prints 1149 instead of 1150