2 ms·
If I read you right, you are saying that if you compute a+b, you'll get a different result than if you compute b+a, if a is tiny and b is huge. I believe this
by BeetleB 8y ago
If I read you right, you are saying that if you compute a+b, you'll get a different result than if you compute b+a, if a is tiny and b is huge.
I believe this is incorrect. Feel free to show me a counterexample.
- jonsen 8y agoa + b commutes all right, but some-start-value +a +b ... +x does not necessarily.
- JadeNB 8y agoAs rhimenoceros points out, that is a failure of associativity, not commutativity.
- rhymenoceros 8y agoNot quite a+b, but a+b+c reordered may give different results[1]. Example from Python: >>> 0.1+0.2+0.3 0.6000000000000001 >>> 0.2+0.3+0.1 0.6 It's an associativity problem and not a commutative one, however, that is relevant to the original point about folding floating point operations over lists. [1] https://www.quora.com/Is-floating-point-addition-commutative-and-associative https://www.quora.com/Is-floating-point-addition-commutative...