[issue9980] str(float) failure

Kiriakos Vlahos report at bugs.python.org
Thu Sep 30 16:56:53 CEST 2010

Kiriakos Vlahos <pyscripter at gmail.com> added the comment:

>>How about doing the check in Py_Initialize() instead? Then it will >>work for embedders too.
It is not good practice for DLLs to change the FPU control word when loaded, because the host application may have set it to a specific value for a good reason.  Delphi provides a SafeLoadLibrary function that saves the the control word and restores it after loading the DLL.

If _Py_dg_dtoa can be made to work correctly independently of the value of the FPU control word that should be much better.  If this means setting and restoring the control word, then this sounds like a good way forward.

By the way the reason Delphi sets the precision to 64bits is that by design all floating calculations are done in 64 bit presision and then truncated back if needed.  A native 10 byte floating type called Extended is also provided.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list