I converted the pseudo-code here into C#, and have it recursively repeat 10,000 times. But I get a C# runtime error, StackOverflow Exception after 9217
StackOverflow Exception
9217
Iterative version:
public static double CalculatePi(int maxRecursion) { double result=1; for(int i=maxRecursion-1;i>=1;i--) { result=1+i/(2.0*i+1)*result; } return result*2; }