I could never quite grasp the precise concept. For starters, some books seem to use absolute error to find the number of correct digits the aproximation shares with the exact value whereas others use relative error. To me, it makes more intuitive sense to use the former, but even so, if you take, for example the numbers 2.97 an 3.01, the abs error is 0.04 which is less than $$0.5*10^{-1}$$ which means they share at least one digit, but I don't see it. What digit is that? It's even more confusing to me when it comes to iterative methods since you don't have access to the exact value. I tried running this code to see if things would get a little more clear:
def eulers_number():
n = 2
k = [2,2.25]
while abs(k[1]-k[0]) >= 0.5 * 10**(-12):
n = n * 2
k.append((1 + 1/n)**n)
k = k[1:]
print(k)
return k[1]
The output is [2.7182818284584274 , 2.718281828458736], the last two iterations, so I should have 12 correct decimal places and yet my calculator gives me 2.718281828459045.... so my 12th digit is actually wrong(8 instead of 9). Why is that? I'm sorry if it all seems pretty basic, but it bugs me a lot and I would deeply appreciate any help. Thanks in advance!