3 ms·
53 bits (double) is not enough to represent 64-bit integers. It was enough for 32-bit integers, but not 64-bit. There are two main reasons: - Modern systems ar
by dottrap 12y ago
53 bits (double) is not enough to represent 64-bit integers. It was enough for 32-bit integers, but not 64-bit.
There are two main reasons:
- Modern systems are now 64-bit and they sometimes have APIs that demand 64-bit integers. (For example, file APIs that deal in bytes like fread).
- Small, embedded systems that are 32-bit or less, which don't have good floating point hardware and are RAM constrained. Lua 5.3 now means double no longer has to be used to represent 32-bit integers. Instead integers can be directly (avoiding floating point for performance) and floating point sizes can be reduced down to float instead of double (reducing the size of internal objects).
Roberto Ierusalimschy (Lua creator) has given several talks about why bring integers to Lua 5.3.
https://www.youtube.com/watch?v=bjqNK1jA77M https://www.youtube.com/watch?v=bjqNK1jA77M