Considering the function $$f(x) = \frac{(e^x -1)}{x}$$
Using L'Hospital's rule, it is shown that,$$lim_{x→0} f(x) = lim_{x→0}\frac{(e^x -1)}{x} =1$$
When checking the results, by writing a program to calculate f(x) for $x=10.0^{-k}, k =1,...15$,
Program L'HospitalApprox implicit none
integer :: k
real :: x, f, abs_error
x = 10.0**(-k)
f = (exp(x)-1.0)/x
abs_error = abs(1.0 - f)
write(*,*) k, x, f, &
abs_error
end do
End Program L'HospitalApprox
Could anyone please provide me with an in-detail explanation as to whether the results agree with theoretical expectations? While, also, explaining why?
Here are some points that I would like further clarifications on:
- What is seen in terms of behaviour of the error as k increases?
- By what rate does the error change?
- What do you think might be causing that error change?

In single precision you will have $\exp(x)=1.0$ for $|x|\ll10^{-8}$. This is because, by the very same limit, you may see that $\exp(x)\approx1+x$, which rounds to $1$ if $x$ is too small.
In fact you can try this, replacing $\exp(x)$ with $1+x$ and get the same issue. See here.
This issue is due catastrophic cancellation, where subtracting close floats leads to a loss of significant figures. This happens often when dealing with difference quotients.
To avoid this issue, you should either use more precision, stop before you lose too many figures, or estimate the limit a different way (for example, symmetric difference quotients converge faster).
In your particular case, you can look at the ratio of errors you got. For the first few steps, the errors decreased by a factor of almost exactly $0.1$ and then this started increasing, eventually leading to a completely wrong answer.