When will A+(B+C) != (A+B)+ C, in a finite precision system

76 Views Asked by At

A, B, C, have finite precisions with machine epsilon of $10^{-16}$. When will the associative law A + (B+C) = (A+B) + C fail in this finite precision system?

I have difficulty to find A, B and C. but I am thinking A can be a big number, B and C are close with opposite signs. So I can generate cancelation error.

like A = $10^{16}$ , B = $10^{-16}$ , C = $-10^{-16}$

A+B = A, as A+B cannot hold so much precision. But I am not sure.

1

There are 1 best solutions below

3
On

An example for A B and C: $$ esp =2^{-52}$$ is the machine epsilon

$$(A+B)+C = (esp + e^{22}) + (-e^{22}) = 0 $$ $$ A+(B+C) =esp + (e^{22} + (-e^{22}) ) = esp$$