Mark Dickinson added the comment: About the implementation of sum: it's worth noting that the algorithm you're using for floats depends on correct rounding of addition and subtraction, and that that's not guaranteed. See the existing test (testFsum) in test_math for more information, and note that that test is skipped on machines that don't do correct rounding.
This isn't an uncommon problem: last time I looked, most 32-bit Linux systems had problems with double rounding, thanks to evaluating first to 64-bit precision using the x87 FPU, and then rounding to 53-bit precision as usual. (Python builds on 64-bit Linux tend to use the SSE2 instructions in preference to the x87, so don't suffer from this problem.) Steven: any thoughts about how to deal with this? Options are (1) just ignore the problem and hope no-one runs into it, (2) document it / warn about it, (3) try to fix it. Fixing it would be reasonably easy for a C implementation (with access to the FPU control word, in the same way that our float<->string conversion already does), but not so easy in Python without switching algorithm altogether. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18606> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com