Throw an error instead of returning NAN/nan

In any scenario that returns NAN/nan, please throw an error instead. Realistically, nobody is ever going to be using nan for anything, (??) so all getting nan does is make you spend a lot of time debugging and looking for reasons why your code isn’t working

The only scenario that I can think of right now that might be a bit messy is checking the unit vector of the origin vector (0,0,0), especially since it is precomputed by Roblox

I think that situations like that should just have their value be nil since theres a quick check for that (you can still do stuff like if not (num > num) and not (num <= num) then print("isNan") end but it would be cleaner to have it act as the rest of the nan cases if this feature request is passed (completely eradicating nan)

1 Like

This would be a pretty drastic change that could break games that already properly check for nan

8 Likes

if num ~= num then

NaN is the only numerical value that isn’t equal to itself.

12 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.