Comment

Comment by rhymenoceros

Not 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...

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton