Division by zero in Windows

Thanks to all that responded to my message, but my problem is not with
infinity itself. My problem is that my program is hanging on divisions
by zero. It’s not integer arithmetic, in the script language I’m using,
Lua, all numbers are doubles. When I use the standalone Lua interpreter,
divisions by zero yield the expected values, positive and negative
infinities. But in my program, where Lua is linked together with SDL and
other libraries, it starts to hang on those divisions.

I have read in the list that DirectX may mess with FPU flags, but I’m
using the windib driver, forced by a putenv. Does anyone know what may
be the cause of this?