lua-users home
lua-l archive

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

Why would one want math.nan?

Perhaps because code that generates such values seems obscure -- i.e., one
is essentially writing code for the error result.

Similarly, there is value in math.inf rather than writing 1 / 0.

I can also see value in routines to test for these cases. It seems obscure
to recognize NaN by using the property that it's the only numeric value x
for which x ~= x.