lua-users home
lua-l archive

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



On Jul 6, 2013, at 11:40 AM, Andrew Starks <andrew.starks@trms.com> wrote:



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. 

Interesting… NaN would actually work as a potential 'empty' then for my intended use, particularly as they can tunnel through the C layer also (though detecting them in a portable way is something I'd have to check up on carefully).

--Tim