While experimenting with lua numbers I stumbled upon the following scenario:
local nan = math.sqrt(-1) --math.sqrt(-1) returns nan
print(nan) --should print nan
print(-nan) --should also print nan(not -nan)
print(nan == nan) --this prints false for some reason
Why does the last statement print false? I think this is the first time I encounter a lua variable that doesn’t equal to itself. Due to this I had to do the following workaround:
print(tostring(nan) == "nan")
1 post - 1 participant