Bug #306
For/Next with Floating point step not executing correct number of iterations.
Start date:
03/15/2020
Due date:
% Done:
0%
Estimated time:
Affected version:
Description
In this example, with step 0.2, 6 iterations are executed correctly:-
Count=0
X=0 : Y=1
Fix 2
FS#=0.2
For F#=X to Y Step FS#
Inc Count
Print F#;
Next F#
print
Print
Print "Iterations:";Count
However, in this example, only 50 iterations are executed and it should be 51. You will see that the loop doesn't actually reach 1.0, only 0.98.
Count=0
X=0 : Y=1
Fix 2
FS#=0.02
For F#=X to Y Step FS#
Inc Count
Print F#;
Next F#
print
Print
Print "Iterations:";Count