Mark Dickinson <dicki...@gmail.com> added the comment: > I would consider compiling the library with flags appropriate to forcing > 64-bit IEEE arithmetic if possible.
Using the right compiler flags is only half the battle, though. You should really be setting the rounding precision dynamically: set it to 53-bit precision before the call to strtod, and then restore it to whatever the original precision was afterwards. And the magic formula for doing this is likely to vary from platform to platform. As far as I can tell, the C99 standard doesn't suggest any standard spellings for changing the rounding precision. It's not unknown for libm functions on x86 to blindly assume that the x87 FPU is set to its default of extended-precision (64-bit) rounding, so it's risky to just set 53-bit rounding for the whole of Python's execution. And contrary to popular belief, setting 53-bit rounding *still* doesn't give the x87 FPU IEEE 754 semantics: there are issues at the extremes of the floating-point range, and I'm not 100% convinced that those issues wouldn't affect the dtoa.c strtod. I'm not saying that all this is impossible; just that it's subtle and would involve some work. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1580> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com