3 ms·
> Lua uses floating point by default, it can't make integer math at all JavaScript does this too. The fact is that with 64 bit floating point numbers, you can
by mortehu 11y ago
> Lua uses floating point by default, it can't make integer math at all
JavaScript does this too. The fact is that with 64 bit floating point numbers, you can exactly represent every integer from -9007199254740992 to 9007199254740992, which is larger than the range of `int` on most systems anyway. 5+6 resulting in 13 is not an artifact of using floating point numbers. CPUs or GPUs don't randomly lose precision like that.
32 bit floating point numbers can exactly represent every integer from -16777216 to 16777216.
See also http://www.lua.org/pil/2.3.html http://www.lua.org/pil/2.3.html
- speeder 11y agoBy the way, your reply was one of the most common replies to me that quickly turned into flaming (people offending me in all way they could to tell me Lua was perfect, and I was seeing things, because 32-bit is enough for the integers I was using...)