Author mark.dickinson
Recipients agthorr, belopolsky, christian.heimes, gregory.p.smith, mark.dickinson, oscarbenjamin, pitrou, ronaldoussoren, sjt, steven.daprano, stutzbach, tshepang, vajrasky
Date 2013-08-12.09:21:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2013-08-12 09:21:06mark.dickinsonsetrecipients: + mark.dickinson, gregory.p.smith, ronaldoussoren, belopolsky, pitrou, agthorr, christian.heimes, stutzbach, steven.daprano, sjt, tshepang, oscarbenjamin, vajrasky
2013-08-12 09:21:06mark.dickinsonsetmessageid: <>
2013-08-12 09:21:06mark.dickinsonlinkissue18606 messages
2013-08-12 09:21:06mark.dickinsoncreate