It seems like Lua addition is not working when dealing with large numbers (64bit values). I have tried to compute the following:
71776119061217280 + 281474976710655
or in hexa
0x00FFFFFFFFFFFF
+ 0xFF000000000000
Lua 5.1, 5.2, and 5.3 all return
72057594037927936 (= 0x100000000000000)
No need to take out your calculator to see that this is wrong. An even number added to an odd number is not an even number. As a matter of fact, it seems to be off by 1 (the right result is 72057594037927935). In hexa the problem is even more obvious since the result should be 0xFFFFFFFFFFFFFF. Anyone knows what's happening, or what I would be doing wrong here?
Update:
For info, I am seeing this with ZeroBrane Studio on Windows 10.