Bug #156
'Dirty' Floating Point Numbers
Start date:
02/08/2020
Due date:
% Done:
0%
Estimated time:
Affected version:
Description
Floating point numbers are becoming dirty during calculations. Here's a small example which illustrates the problem.
D#=0.0
Do
D#=D#+0.01 // D# should at some point become exactly 2.0
If D#=2.0 Then Print "Test OK" : End
If D#>3.0 Then Print "Test Failed" : End // But it doesn't!
Wait Vbl
Loop
To view what actually happens to the numbers, run this:-
D#=0.0
For X=0 to 88 Step 22
For Y=0 to 30
Locate X,Y : Print D# : D#=D#+0.01
Next Y
Next X