lua-users home
lua-l archive

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


On Jul 6, 2013, at 10:53 AM, Javier Guerra Giraldez <javier@guerrag.com> wrote: how do you use a placeholder that can't be equal to anything, not even
> to itself?

I don't see why not.  Thats the point it is missing it cant be equal to anything.  That is the easy test for nan and as far as I know gives a unique result.  The beauty of nan is if you have an array that has missing values and you mistakenly use one of the missing values without checking it nan will propagate to every dependent calculation and any attempt to print an invalid result will give a result of nan.




> 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
>