Floating-point multiplication

Alex Holkner xander at yifan.net
Tue Feb 5 06:43:29 CET 2002

> I don't know what "embedded python" means to you, and the answer
> is probably
> crucial.

Nothing special, it's a win32 app which runs Python scripts with
Py_Initialize / PyRun_SimpleString / Py_Finalize.

> "precision control" mode.  Core Python doesn't muck with the FPU control
> registers, so something outside of core Python you're doing, or
> calling, is
> doing the damage.  Scour the sources for calls to control87, _control87,
> controlfp or _controlfp.  If you find exactly one such call, it's wrong
> <wink>.

No luck, unfortunately.  My application makes use of DirectX (which I know
uses single-precision, but obviously I can't check its source, and I doubt
there's a bug there), and ODE (a dynamics library.. but no FPU control
functions used that I can find).

I tried putting _control87(_PC_64, _MCW_PC) before Py_Initialize and
PyRun_SimpleString (and restoring it afterwards); which makes everything
work as expected.  This is obviously not a fantastic solution, but it does
show that you're right about the cause of the problem.

I might play around with moving my _control87 around the code a bit to try
and find the cause, unless someone already knows of a DirectX issue (using
Direct3D7 interfaces)?

Thanks heaps for your help,

More information about the Python-list mailing list