lua-users home
lua-l archive

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

Duncan Cross wrote:
On Sun, Jul 19, 2009 at 12:07 PM, Toni Spets<> wrote:
I wrote a hack that resets the FPU to it's original state before executing
Lua and then setting it back to "optimized" mode. That seems to do the trick
but I'm not 100% happy with it.

The question here is: why this breaks Lua and should Lua do anything from
the language side to workaround situations like this?

This has come up before - Microsoft's DirectX will also clobber the
FPU to single-precision mode when it starts up unless specifically
told not to (search the Lua list archive for 'DirectX' and you should
be able to find discussion about it). Unfortunately, unless the
situation is different here somehow, the conclusion was that there
isn't anything Lua can reasonably do out-of-the-box to dynamically
work around it. I believe you can redefine lua_Number to be a
single-precision float, but then of course you no longer have enough
bits of integer precision to store all 32-bit integers. If what you
have works, it may well be the best option available.


Thanks for the reply.

Should've searched the archives first :-)

Toni Spets