Generally, when you want to store a number in memory, you'll define it as a specific
type of number. For example, a "unsigned byte"-type is generally used when you want to store integral values ranging from 0 to 255. A two-byte "signed int" is suitable for the range of −32,768 to 32,767.
Exactly how much memory is assigned to a given type varies a bit by language (generally it goes up as time has gone one - a byte's always a byte, though). In the case of Lua, however, you don't assign a specific type for your numbers - they're just referred to as "numbers", no matter what. In the background... they're all float types.
Floats can handle fractions, and they can do a pretty good job of it, but they still only have a limited, static amount of memory available with which to store numbers. This leads to a problem - there are a LOT of potential fractions that can go alongside any given int. So, floats fudge things a bit.
Usually this inaccuracy doesn't matter, but sometimes it can lead to odd results. This being a case in point.
Here's another,
and another...
For more info,
take a read through this.