lua-users home
lua-l archive

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


> I was pleasantly surprised just now to find that tonumber( "nan" )
> does the right thing.

Not with Visual C++ 6 or 7. It produces some funky formatting
(e.g. "-1.#QNAN") when tostringing a nan. And that is not reversible.
Don't know what, if any string, it does accept as a nan with tonumber().
Similarly so for infinite numbers.

> So, one could dump numbers by testing for the special cases.

Testing that has some issues as well. It should suffice to check if n==n
yields false to detect a nan, but Visual C++ 6 emits erroneous floating
point code that breaks that test.

Albert-Jan