How to print numbers in the decimal point format such as loop 0.01. If I want to print
0.01
0.02
0.03
0.04
0.05
......
0.99
How does PHP print such numbers? How can I print it out with?
Reply to discussion (solution)
for ($i=0.01; $i < 1; $i+=0.01) { echo $i."
";}
There is a problem,
For example, I want to print
81.1-99.1
Number
Using the circular method on the second floor, the problem will occur in the 90 s. how can this problem be solved?
for ($i=0.01; $i < 1; $i+=0.01) { echo $i."
";}
There is a problem,
For example, I want to print
81.1-99.1
Number
With this method, problems will occur in the 90 s. how can this problem be solved?
For ($ I = 81.3; $ I <99.4; $ I + = 0.01) {echo round ($ I, 2 )."
";} // The content after the second semicolon in $ I + = 0.01 for indicates the added amount. $ I + = 0.01 indicates the amount added at a time in each loop. $ I + = 0.01 indicates that is added at a time and your $ I + = 99.3 indicates that each time 99.3 is added, 81.3 is added, and 99.3 is more than 99.4, so this loop ends only once.
For ($ I = 81.3; $ I <99.4; $ I + = 0.01) {echo round ($ I, 2 )."
";} // The content after the second semicolon in $ I + = 0.01 for indicates the added amount. $ I + = 0.01 indicates the amount added at a time in each loop. $ I + = 0.01 indicates that is added at a time and your $ I + = 99.3 indicates that each time 99.3 is added, 81.3 is added, and 99.3 is more than 99.4, so this loop ends only once.
First of all, thank you very much for your patience, but I am not talking about this, it is automatically converted to a floating point. To 90.0999999999.
The result is 90.1.