What is the resulting precision from an exponent operation?

36 Views Asked by At

Say I want to perform exponentiation on some decimal number (like a measured weight) and some integer exponent (like ^2 or ^3). What are the general rules for the resulting precision(significant digits)?

Example with: 12.345 ^ 3

Should it be...

 = 1881.365963625  (13 digits) 

Why: From my understanding, if "12.345" was exact, this would be the answer but 12.345 is not exact.

Or, Should it be...

1881. (4 digits)

Why: Since I don't know any digits past 12.345. In fact, from my understanding, a measurement of 12.345 could be 12.3445 to 12.34549999... So with that,

Using the worst-case high/low, we get...

  • 12.3445 x 12.3445 x 12.3445 = 1881.13737
  • 12.345499.. x 12.345499 x 12.34549999 = 1881.59457

and from this, we can see just four digits are accurate, so 1881. (4 digits)

Or, should it be...

1881.4 (5 digits)

Why: That is the size of the base.


Additional notes:

  • This is for a decimal class I'm building and want the Power(myBaseAsDecimal, myExponentAsInteger) function to have the correct resulting precision.
  • Is there no correct answer? ...and it depends on what we are doing. I'm going to guess there is no correct answer however, the "1881" example I gave should be the default for the function. But I wanted to get the community's feedback.

Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

If you have a decimal number $x$ which is only known to a precision $\epsilon$ – that is, if all you know is that the number is between $\alpha-\epsilon$ and $\alpha+\epsilon$ – then (to a first approximation) you have $x^2=\alpha^2\pm2\epsilon\alpha$, $x^3=\alpha^3\pm3\epsilon\alpha^2$, and, in general, $x^n=\alpha^n\pm n\epsilon\alpha^{n-1}$. These estimates rely on the assumption that $\epsilon$ is small compared to $\alpha$.

In your example, $x=12.345\pm.0005$, so $x^3=(12.345)^3\pm(3)(.0005)(12.345)^2=(12.345)^3\pm0.2286$ so you're only justified in keeping the figures to the left of the decimal point. This agrees with your 2nd computation.