No Bug.
Floats have only 24 significant bits, which means you can store integer numbers just until ~ 16 mio.
Your integer number needs more than 26 bits, so the last binary digits are lost during your calculation and the number (even the integer part) becomes inaccurate.
You can use Double, they can store 52 bits.
Edit: An example, at which point the inaccuracy starts:
Code: Select all
Define Float.f
Define Integer.i
Debug 1<<24
Debug "----"
For Integer = 16777210 To 16777230
Float = Integer
Debug Str(Integer) + " vs. " + StrF(Float)
Next
16777216
----
16777210 vs. 16777210
16777211 vs. 16777211
16777212 vs. 16777212
16777213 vs. 16777213
16777214 vs. 16777214
16777215 vs. 16777215
16777216 vs. 16777216
16777217 vs. 16777216
16777218 vs. 16777218
16777219 vs. 16777220
16777220 vs. 16777220
16777221 vs. 16777220
16777222 vs. 16777222
16777223 vs. 16777224
16777224 vs. 16777224
16777225 vs. 16777224
16777226 vs. 16777226
16777227 vs. 16777228
16777228 vs. 16777228
16777229 vs. 16777228
16777230 vs. 16777230