My book suggests the following exercise.
Which one from the following approximation of $\pi$ minimises the error propagation due to rounding errors?
$$\pi = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - \ldots)$$ or $$\pi = 6\left(0.5 + \frac{1}{2}\frac{1}{3}\left(\frac{1}{2}\right)^3 + \frac{1\cdot 3}{2\cdot 2}\frac{1}{2!}\frac{1}{5}\left(\frac{1}{2}\right)^5+\frac{1\cdot 3\cdot 5}{2\cdot 2\cdot 2}\frac{1}{3!}\frac{1}{7}\left(\frac{1}{2}\right)^7+\ldots\right)$$ Using MATLAB, compare the results obtained letting varying the number of addends.
I am not sure about the answer: in the first expansion less arithmetic operations are performed (and so there is less rounding error) but the convergence is much slower. On the other hand with the second method the convergence is fast but there are a lot of operations.
Here is the result of my simulation using OCTAVE, I post a screenshot.
You can see the number of iterations needed: i=1,2,...