# Relative error when exact quantity is $e^{-200}$ and significant digits; what's going on?

Caveat: I've already searched for this topic here in MSE but also on other sites, but I have not still found anything that can answer my doubt.

I'm checking my own implementation of a code. The context is not important. The correct value is $$x=e^{-200}$$, and I computed $$\hat{x}$$ with my routine.

• I computed the absolute error $$|x- \hat{x}|=1.2\cdot10^{-14}$$. This means that in $$\hat{x}$$ I have 14 correct digits of $$x$$.

• If I compute now the relative error I have $$\frac{|x-\hat{x}|}{|x|} = 8.67 \cdot 10^{72}$$. I know it is related to the number of significant digits, and in this case the denominator $$x=e^{-200}$$ is not zero (even in is really small).

I'm really puzzled because I can't understand what is going on: I mean, the result of the relative error is saying me that the approximation is poor? But the first $$14$$ digits are equal.

Your $$x$$ has 86 zeros after the decimal period. So having determimed the first 14 zeros you are still 72 zeros away from the real thing.
More technically, your error is $$10^{72}$$ bigger than the actual $$x$$, which is what your quotient is showing.
• Okay, so the relative error takes into account ALL the significant digits of the number. Right? Since $e^{-200}$ has 87 zeros before the beginning of the significant digits, and my $\hat{x}$ is exact only on the first $14$ (which are all zeros), the relative error of $10^72$ is saying me the information about what you call the "real thing". Commented Aug 1, 2020 at 8:47
• Yes. For instance $10^{-15}$ is within your tolerance, and it is $10^{72}$ times bigger than $x$. Commented Aug 1, 2020 at 14:29
• Do you mean that even if $\hat{x}$ is accurate up to $15$ digits, it is $10^{72}$ times bigger? @MartinArgerami Commented Aug 1, 2020 at 14:40
• Yes. Like I said, $10^{-15}$ is accurate up to 14 digits, and $10^{72}$, times bigger than $x$. Commented Aug 1, 2020 at 14:46