Hi,
Im trying to increment a negative number towards 0 onwards - and store the result in my array.
my negative number has 6 places and can only range from
-2.000000 to +2.000000
I have a start value, the step to increment by, and a limit - which resets back to start value
so I might have a start value of -1.351451 - with an increment of 0.000020 until a value of 1.300000 is reached = in which case the next value to be stored will be reset to the start value of -1.351451
im no good at explaining - so here is my code!!
start = -2.000000
limit = 2.000000
addon = 0.001000
result = start
For x = 0 To Counter
Bots$(x, 7) = val(result)
result = result + addon
If result > limit Then result = start
Next
the trouble is as i get near to 0 the results are whacky!!
im getting more then 6 decimal places, letters and - i cant find out what’s wrong!
any help would be pucka!
Many thanx!
QBasic is fun! Go see what I've done!
Im trying to increment a negative number towards 0 onwards - and store the result in my array.
my negative number has 6 places and can only range from
-2.000000 to +2.000000
I have a start value, the step to increment by, and a limit - which resets back to start value
so I might have a start value of -1.351451 - with an increment of 0.000020 until a value of 1.300000 is reached = in which case the next value to be stored will be reset to the start value of -1.351451
im no good at explaining - so here is my code!!
start = -2.000000
limit = 2.000000
addon = 0.001000
result = start
For x = 0 To Counter
Bots$(x, 7) = val(result)
result = result + addon
If result > limit Then result = start
Next
the trouble is as i get near to 0 the results are whacky!!
im getting more then 6 decimal places, letters and - i cant find out what’s wrong!
any help would be pucka!
Many thanx!
QBasic is fun! Go see what I've done!