How big is math.huge and the number limit?

How big is math.huge?

I didn’t find any documents on it at all

I know it’s INF but I want a number


I also need to know what the number limit is before the value goes crazy (like going negative) because it’s too big

8 Likes

I don’t understand the question…? math.huge is infinite :infinity:, there isn’t a numerical equivalent.

6 Likes

“math.huge is any number greater than or equal to 2 to the power of 1024 minus 1, which can be represented in Lua by math.huge >= 2^1024 - 1”

Webpage

37 Likes

what about the number before reaching math.huge?

like let’s say 11 is math.huge and 10 is before hitting math.huge?


and thank you @RedDuck765 I’ll give it a read! :grin:

2 Likes

The number before reaching math.huge = 2^1023.999999999…
you can test it in game:

print(2^1024 >= math.huge)  --->>>  true
8 Likes

I just realized that when I checked out the page.

Thank you both!

3 Likes

Lua uses doubles for floating point numbers, the limit is after the highest number you can represent with a double value in the negative or positive direction. Depending on the storage type, you can look up their ranges and how they are handled. Inf is actually part of floating point and part of the way it is handled, not specific to Lua (so is NaN)

6 Likes

Is it possible for tick() or os.time() to reach this value and mess up code?

8 Likes

Yes but only if you are still running your code in the year 2849862293694200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.

39 Likes

gotem

9 Likes

this made me slightly depressed

44 Likes