Joerg Arndt writes:
* Mike Stay <metaweta@gmail.com> [Apr 15. 2015 17:38]:
Addition isn't even associative in floating point: http://en.wikipedia.org/wiki/Associative_property#Nonassociativity_of_floati... so floating point numbers don't even form a monoid under addition. Is addition commutative?
I don't think so: Take one value L so large that adding 1.0 does not change it at all. Also take very many 1.0's (indeed take L of them). Now 1.0 + 1.0 + 1.0 + ... + 1.0 + L ==> 2.0 * L but L + 1.0 + 1.0 + 1.0 + ... + 1.0 ==> L
You're both reassociating and commuting here. If you just commute, then you need to compare: (1.0 + 1.0 + 1.0 + ... + 1.0) + L vs. L + (1.0 + 1.0 + 1.0 + ... + 1.0) which one would hope are the same. But they might not be 2*L, since if L is sufficiently large, then at some point adding one to the sum may stop having and effect. In any case, I don't think this example addresses the question of commutativity. Tom