BTW, here's a fun one:
10 FOR X=10 TO 0 STEP -0.1:NEXT X:PRINT X
Math error in simple FOR loop with decimal 0.01
Re: Math error in simple FOR loop with decimal 0.01
Quite. It takes more iterations to hit the same imprecision as with 32bit floats, but it will still get there, since there will always be a rounding error at the last bit.
Re: Math error in simple FOR loop with decimal 0.01
Ran the same 3 sets in C64 BASIC (VICE emulator) and the first program hits the same exact issue at the same number (23rd), but doesn't hit the rounding problem till the 79th iteration with the 2nd setup.
Just weird.
But anyway, glad to know it's at least known.
Just weird.
But anyway, glad to know it's at least known.