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
Recursive function calls are almost always a really awful way to do things.
I would simply get the value of pi from a header file/math library.