As you phrased the question, it is not generally true. There exist x, y, and z such that (x+y)+z = x+(y+z)
. But you likely intended to ask whether or not it is always true that (x+y)+z = x+(y+z)
. It is not always true.
An obvious counterexample is (264 + −264) + 1 and 264 + (−264 + 1). With 64-bit binary IEEE-754 arithmetic, the former is 0 + 1 = 1, and the latter is 264 + −264 = 0. In the latter, the 1 was lost because the magnitude of −264 is so great the sum did not have enough precision to include the 1.
There are more subtle cases, where just a part of one number is lost.