[issue13889] str(float) and round(float) issues with FPU precision

Samuel Iseli report at bugs.python.org
Fri Feb 3 14:51:41 CET 2012


Samuel Iseli <samuel.iseli at gmail.com> added the comment:

I would definitely classify this as a bug in Python 2.7 as it breaks backwards-compatibility for embedding environments that default to 64bit FPU precision (e.g. Delphi).

Additionally the bug is very hard to detect and leads to wrong values with possibly disastrous effects.

Appended a patch with a new implementation of the Py_SET_53BIT_PRECISION_* macros for win32:

- precision is set only when needed
- setting and restoring only the x87 controlword (using __control87_2
  function).
- macros are not used for WIN64 as there's no x87 there
- there's no need for a custom symbol in the vc project anymore, 
  as I'm using the predefined _WIN32 symbol.

----------
Added file: http://bugs.python.org/file24408/74745.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13889>
_______________________________________


More information about the Python-bugs-list mailing list