[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: x86 floating-point unit assembly messing up Lua
- From: Duncan Cross <duncan.cross@...>
- Date: Sun, 19 Jul 2009 12:26:20 +0100
On Sun, Jul 19, 2009 at 12:07 PM, Toni Spets<firstname.lastname@example.org> 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.