Project

General

Profile

Bug #306

For/Next with Floating point step not executing correct number of iterations.

Added by David Baldwin about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
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

#1

Updated by David Baldwin about 4 years ago

Fixed in 0.9.8. Test 2

#2

Updated by David Baldwin about 4 years ago

  • Status changed from New to Closed

Also available in: Atom PDF