lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Saturday, July 6, 2013, Javier Guerra Giraldez wrote:
On Sat, Jul 6, 2013 at 12:07 PM, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
> I am not understanding what is wrong with using nan as a place holder

> n1=0/0
> n2=0/0
> print (n1, n2, n1==n2, n1==n1)
-nan    -nan    false   false

how do you use a placeholder that can't be equal to anything, not even
to itself?


--
Javier


type(n1) ~= "string" and tostring(n1) == "-nan"
? Is it type number? If so, it's the only number not equal to itself, so you've got that going for it.