[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Re: lua_newthread etc.**
**From**: Gunnar Zötl <gz@...>
**Date**: Wed, 22 Jan 2003 18:16:32 +0100

Hi,
AJB> Also, has it been considered to extend the math
AJB> library with isnan() and infinity() so that
AJB> Lua can check against exceptional floating point
AJB> values?
actually, you can. Well, on some platforms, at least... not sure about
that. I'm pretty sure it depends on the floating point implementation
your C compiler uses. IEEE should be OK. You can write something like
> infinity=1/0
> =infinity
1.#INF
> NaN=infinity/infinity
> =NaN
-1.#IND
(I assume the outcome of infinity/infinity to be not a number.)
You can then compare and even calculate with these:
> =1/infinity
0
> =infinity/1
1.#INF
> =infinity == (87123456/0)
true
> =infinity == 17
false
> =NaN+1
-1.#IND
seems to look like what one would expect. Of course, technically the
third querys result is not correct, but it is the behaviour one would
like to have, I think.
Gunnar