Calculate $\pi$ to an accuracy of 5 decimal places? In this message at point 18 I saw following programming question:

Given that $\pi$ can be estimated using the function $4(1 – 1/3 + 1/5 – 1/7 + \ldots)$ with more terms giving greater accuracy, write a function that calculates Pi to an accuracy of 5 decimal places.

So I know how to implement the given function and how to choose how "far" I should calculate, but how can I tell when I've reached the "accuracy of 5 decimal places" ?

The series you wrote is an  Alternating series. The alternating series test says that for such a series, the error in the approximation is less than the absolute value of the first missing term.
In other words, if the last term you have is of the form $\pm \frac{1}{2n+1}$, then  your approximation is good within $\frac{1}{2n+3}$. To be sure that this is accurate to the 5th digit, you need
$$\frac{1}{2n+3} \leq 0.00001$$
