by stephencanon · 13y ago · 0 comments
(Standards-conformant) floating-point addition and multiplication absolutely are commutative up to NaN encodings. This follows trivially from the fact that they are basic operations (and hence correctly rounded), combined with the fact that the corresponding operations on real numbers are commutative.
Feel free to ask other questions about floating-point superstitions, and I’ll do my best.
The rest of the article is great, and really hits at how to deal with mixing floating point arithmetic with really small and really large numbers. Start small so the partial sum remains as accurately as possible, since any exponential corrections will result in shedding some significant digits. Then again, if this is the point at which you start nit-picking about commutativity, you should probably use a higher precision floating point representation, or look towards "infinite" precision numerical libraries.
EDIT: found it http://en.wikipedia.org/wiki/Kahan_summation_algorithm
[1] www-2.cs.cmu.edu/afs/cs/project/quake/public/papers/robust-arithmetic.ps
Thanks.