2

When we are doing calculations in mathematics, we often express exact values, like $\sqrt 2$ or $\arctan (1)$, as decimals and round these to a finite number of decimal places/significant figures before using these approximations in subsequent calculations. We might also round off a very long but finite decimal and use it in subsequent calculations. My question is, what is the minimum number of decimal places/significant figures which all of my intermediate values must be rounded to if I want my final answer to be accurate to a particular number of decimal places/significant figures?

Example: I'm doing a $\chi^2$ test. I want to find $\chi^2$ exact to $1$ decimal place. The exact $\chi^2$ contributions are: $(0.56,0.32,1.76,1.99,0.72,0.88)$. If I sum these, the exact value of $\chi^2$ is $6.23$, which becomes $6.2$ rounded to $1$ decimal place. Now if I round the contributions to $1$ decimal place, so they become $(0.6,0.3,1.8,2.0,0.7,0.9)$, before I sum them, I get the sum to be $6.3$, which is not accurate to $1$ decimal place, as we have shown it should be $6.2$.

How can I be sure that my intermediate values are rounded with enough remaining decimal places/significant figures that my final answer is accurate to a desired number of decimal places/significant figures? Not just for this particular example, but for a general calculation.

  • 5
  • Thanks @RossMillikan for pointing me towards these. Having read the second question, I believe the answer to my question is basically "No, there is no rule which tells you how many d.p.s/sig figs your intermediate values must have as a minimum to ensure your final answer is accurate to a particular number of d.p.s/sig figs", is this correct? – Rational Function Apr 03 '19 at 19:46
  • Yes, that is correct because the sum may be close to a breakpoint. You will rarely fail if you keep a couple more digits, but it can happen. – Ross Millikan Apr 03 '19 at 20:00
  • @RossMillikan I may have come up with a formula which works for sums (and by extension subtractions). If we sum $n$ infinite decimals and we want our answer to be accurate to $x$ decimal places, then $y>x+\log(n)$ where $y$ is the number of decimal places that each summand can be rounded to, such that the final answer is accurate to $x$ decimal places. This formula allows us to find $y_{min}$. This should at least solve my $\chi^2$ example, however, I imagine it's difficult or impossible to come up with such rules for more complicated calculations or even a general rule. Is that correct? – Rational Function Apr 03 '19 at 20:49
  • No, that is not good enough. Even summing two numbers you can get into trouble. Say you want one decimal place in the sum, so a sum of $0.5$ could come from an exact sum in the range $[0.45,0.55)$. Now try adding $0.2500000000$ and $0.2000000001$ and also adding $0.25000000000$ and $0.199999999999$. The second addends are equal to ten or so places, but the correctly rounded sum is different. – Ross Millikan Apr 03 '19 at 20:54
  • Thanks @RossMillikan, yep my formula is definitely wrong! I thought it must be, given your answers on other posts, but I hadn't found a counter example. – Rational Function Apr 03 '19 at 21:06

0 Answers0