lua-users home
lua-l archive

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


On 6 November 2010 14:08, Mike McGonagle <mjmogo@gmail.com> wrote:
> Not trying to dredge up this topic again, but I can't quite seem to
> find the "definitive" method of making this test. Currently my
> programs are just throwing errors and stopping, I would like to be
> able to detect when this happens, discard the results, and then move
> on to the next iteration of my program.

Luiz's lmathx [1] provides isnan and fpclassify if you prefer which is
certainly definitive as it just gives you access to the C99 math
additions. Alternatively, testing x ~= x on a Lua number is correct
(and this is how the internal luai_numisnan macro is defined).

Alex

[1]: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmathx