[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Has Lua reached perfection?
- From: Sean Conner <sean@...>
- Date: Sun, 28 Jan 2018 21:16:25 -0500
It was thus said that the Great nobody once stated:
> Beside incoming improvements, present Lua also contains lots of tiny
> warts... NaN being unusable as a table key is one of the bigger kinks –
> a "discontinuity" in the type/value space that's hard to check for and
> generates complexity whenever you have to deal with it.
Just in case you are unaware (or others are unaware), NaN is a special
value defined by IEEE-754 (or rather, values) that have a unique property:
x = 0/0
print(x,x==x)
nan false
A NaN is not equal to anything, including itself! In fact, according to the
standard, this:
x = 0/0
y = 0/0
is not even guarenteed to produce the same bit pattern! x and y just have
to be designated as NaN. So it would be difficult to make NaN to be a table
value.
-spc