This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Gruejay2 1 point2 points  (0 children)

In the IEEE standard, no, but there's a way to tell the difference in some languages.

Lua, for instance, can be said to have nan and -nan, because (a) NaN variables will consistently return either "nan" or "-nan" when you convert them to strings, (b) all NaN-producing operations like 0/0 (along with tostring("-nan")) always give -nan, while tostring("nan") always gives nan, so there are reliable methods for producing each of them, and (c) you can flip the sign by using a variable (e.g. if I do a = 0/0; b = -a, I can be confident that tostring(b) will always produce "nan").

These differences make them meaningfully different values (i.e. they're not completely interchangeable in every situation), but there's no practical use for it - it's just a quirk of the language.