I am looking to use the largest number available in Lua. I assumed this number would be 2,147,483,647 (signed 32 bit Int) or 4,294,967,295 (unsigned 32 bit Int). After a little testing it appears to be 99,999,999,999,999. It's a lot better of course, but can someone explain why this is the biggest number?
I think LUA uses a 53 bit number, so 2^53 would be the biggest integer you could have.
I also discovered recently that sometimes when doing math you can get the result -0.0 which causes lots of bother. In that case you can check vs the following... 2^-53
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Actually the biggest integer you can store is 1.7976931348623157 × 10^308, since this was your original question, but the only operations you can do on it without losing information is dividing it by 2 or substracting another number with the same exponent...
Comments
I also discovered recently that sometimes when doing math you can get the result -0.0 which causes lots of bother. In that case you can check vs the following... 2^-53
You can always process the data like the old days, so if it exceed that 1e+14, simply put big numbers at another variable, and mod it.
Likes: antix
https://deluxepixel.com
Likes: antix, SinisterSoft
Drumroll...
4,503,599,627,370,496
Likes: antix
Likes: totebo