lua-users home
lua-l archive

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


In OSX 10.6 w/ Lua 5.1.4.

> v = 1/0
> if v then print("true!") else print("faux!") end
true!
> print(v)
inf
> print(type(v))
number

not NaN?

2011/2/23 Axel Kittenberger <axkibe@gmail.com>
> Not a value can be none of greater than, equal to or less than a number.
>
> Lua's default behavior with respect to NaN is based on standards
> compliance - IEEE 754 as cited in PiL 13.2.

Dirk didnt mean what it does in comparisons, you are correct the
standard covers this. But Lua allows _any_ variable to be used in
logical algebra by itself only, where so far false and nil behave as
logical false, everything else as logical true.

local v = 1 / 0
if v then
 print("it is true!")
else
 print("it is false!")
end

what should it do?