[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tribool
- From: Doug Currie <doug.currie@...>
- Date: Wed, 17 Nov 2010 00:13:13 -0500
On Nov 16, 2010, at 11:51 PM, Alexander Gladysh wrote:
> I'm looking for the Lua equivalent for this:
>
> http://www.boost.org/doc/libs/1_44_0/doc/html/tribool.html
You can get a long way with using
true := 1.0
false := 0.0
indeterminate := NaN
with these functions:
function tri_and (x,y) return x * y end
function tri_or (x,y) return math.min(x + y, 1) end
function tri_not (x) return 1 - x end
> tri_unk = 0/0
> return tri_unk
nan
> =tri_or(0,tri_unk)
nan
>
e