This really is the way floats work. In this case 0.1 is not exactly representable.
Starting with
x# = 0.1
This tries to assign 0.1 to x. The value 0.1 is displayed by Blitz with Text or Print.
But the display is rounded to six digits. In fact, 0.1 is not the exact value of x.
If you are curious, the exact value of x is 13421773 / 134217728.
The denominator is 2^27. If the denominator could be 134217730 then x would be 0.1 exactly.
But 134217730 is not a power of two, so that can't happen.
So x is 0.1 plus a very small error. When x is repeatedly added to a running total an error is also repeatedly added.
Eventually the total error is large enough to see.
Here's a quick look at the exact value of x.
Starting with
x# = 0.1
This tries to assign 0.1 to x. The value 0.1 is displayed by Blitz with Text or Print.
But the display is rounded to six digits. In fact, 0.1 is not the exact value of x.
If you are curious, the exact value of x is 13421773 / 134217728.
The denominator is 2^27. If the denominator could be 134217730 then x would be 0.1 exactly.
But 134217730 is not a power of two, so that can't happen.
So x is 0.1 plus a very small error. When x is repeatedly added to a running total an error is also repeatedly added.
Eventually the total error is large enough to see.
Here's a quick look at the exact value of x.
Graphics 300, 130, 0, 2 x# = 0.1 ; Now double it 27 times. For n = 1 To 27 x = x * 2 Next Text 20, 40, "Rounded to six digits: " + x Text 20, 60, "Exact value is really: " + Int(x) WaitKey : End