1

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.

Di Wang
  • 511
  • 1
    How about when $B+C$ is large enough to be treated as "non-zero" but each of $B$ and $C$ are individually small enough to be considered "zero" in comparison to $A$. So, for example, $A=10^{16}$ and $B=C=0.5$. Here we would have $A+B=10^{16}+0.5\approx 10^{16}$ and this result plus $C$ would again remain $10^{16}$ since $0.5$ is too small to successfully add, but $A+(B+C)=10^{16}+1$ and $1$ is not so small as to not matter anymore. I am not particularly familiar with the specifics the rules governing finite precision systems, but I assume this example should work or can be modified to work. – JMoravitz Apr 16 '18 at 23:06
  • 1
    I can make B and C really big, but A really small. so that $A+B = B$, and $C= - B$. so $ A+(B+C) = A $, but $(A+ B)+C = B+C = 0 $ – Di Wang Apr 16 '18 at 23:27

1 Answers1

0

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$$

Di Wang
  • 511