lua-users home
lua-l archive

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



On Mar 09, 2004, at 06:23, Thatcher Ulrich wrote:

On Mar 09, 2004 at 07:45 +0800, Brett Bibby wrote:

We are also using 24 bit precision because of DX and I converted Lua
to use floats. It seems that it's actually Lua that is trashing the
FPU in certain cases from the VM. Perhaps there is some casting
to/from float between script tokens or something that is causing
this?  I don't have the time to track it down atm, but I will try to
find the exact cause, meanwhile wrapping the calls into and out of
Lua fixes the problem (which is the FPU nan bit gets set when a read
occurs on an uninited register).

A good debugging tool in this situation is to turn on FPU exceptions,
and run in the debugger.  It should break on the line that does an
invalid op.  Assuming that's what's going on.  Might help you, might
not, but when it helps it really helps.

I may be misremembering here:

Doesn't IA32 have some crufty FPU flag that means "Yes, I really want all my floating point exceptions to occur on the instruction that caused them and not the next FPU instruction that I execute which could well be after a branch or a function return". You want to switch that on too.

drj