In maths, addition (of real numbers) is commutative and associative, ie. for all numbers x, y and z
x + y = y + x (commutativity)
and
x + (y + z) = (x + y) + z (associativity)
Multiplication of real numbers is also commutative and associative. But is this true for ints and floats in .NET? Counterexamples welcome.
Edit: Background is we've recently parallelised an algorithm and now its results are no longer consistent between repeats. I speculate this might be due to the atomic calculations returning (and being merged) in non-deterministic order. In which case, the inconsistency could be fixed by a smarter (but slower) merge algorithm (that sorts the results before merging). I'd like to know what assumptions it can make about .NET arithmetic.