lua-users home
lua-l archive

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


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