lua-users home
lua-l archive

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

On Feb 28, 2005, at 17:09, Mark Hamburg wrote:

on 2/28/05 8:32 AM, David Jones at wrote:

Show me some code that might use math.nan. if x == math.nan ? I don't
think so.

    x = 0
    for index = 1, 100 do
        x = x + ( t[ index ] or math.nan )

Any missing indices will result in a sum of NaN.

That seems reasonable; I'm convinced that on machines that support NaN there might be good uses for math.nan (and the case for math.isnan and math.isinf is even clearer).

So, supposing that one adds math.nan, what value should math.nan have on machines not supporting NaN? 0, nil, false?

David Jones