|
> Mostly because of this:
>
> i = 1<<62
> a = 2^62
> print(i, a)
> i = i * 4
> a = a * 4
> print(i,a)
>
> Now, I know what is going on, and you know what is going on. But does the average scripter know? I totally agree that string.sub(“foo”, 2) and string.sub(“foo”, 2.0) should return the same result, and that string.sub(“foo”, 2.5) should give an error. Then overflows come along and I would expect a user to go “er .. what???”. And of course the trouble with overflow type errors is they frequently slip through testing (how many times have you seen a dialog box with a negative “time remaining” value?).
A very common question from beginners (and most "average scripters")
runs like this:
> a = 1/3 - 1
> print((a + 1) * 3 == 1)
--> false ??????????????????????????
We have had this happening since the very first version of Lua. Scripters
do not know what is going on. They ask, they learn. Good for them.
-- Roberto