lua-users home
lua-l archive

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


This is a bit OT.

I have a special NaN to represent a NIL value - see my other thread "Comparing userdata with other types". My experiments show that it gets preserved by the FPU operations:
Special_NaN+5=Special_NaN
-Special_NaN=Special_NaN

In your experience, do you think I can count on that? (I'm only interested in 32/64-bit Windows).

Thanks
Ivo

Mike Pall wrote:
So there's no need to canonicalize NaNs after
every operation, which is an expensive step in your patch. The FPU
on its own only generates 0xfff80000_00000000. Canonicalization is
only needed for the two ingress points (lua_pushnumber and
string2number).