How to check for nan
-
Is there a way to check if a value is not a number
nan
? I could prevent using negative values withsqrt
, so no problem if it's not possible, but I noticed that evensqrt(-1) == sqrt(-1)
equalsfalse
...I do agree with the choice to tolerate weird input values like this, since it aligns well with the use-case for Fuze. It's just a little unexpected quirk i happened to run into.
-
silly idea, what about: (partially tested)
n = sqrt(-1) if (str(n) == "nan") then print("is no valid number") endif
-
Nice, that works 👍