Hello guys, I got a strange problem when using for loop.
For example, the following code
for ($j = 0.0; $j <= 2; $j+=0.2) {
print $j, " ";
}
gives
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 ,
which is normal since the loop is executed 11 times as expected.
However, the following code
for ($j = 0.0; $j <= 3; $j+=0.2) {
print $j, " ";
}
gives
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 ,
where the loop is executed only 15 times instead of expected 16 times!
I can't figure out why, any help is appreciated, thanks!
:confused: :confused: