Skip to content

Instantly share code, notes, and snippets.

@Zepheus
Created December 6, 2013 15:12
Calculates Pi through Taylor expansion or Arctan.
static double Pi()
{
var value = 1d;
for (var i = 1; i < 10000; i++)
value += Math.Pow(-1d, i) * (1d / (2*i + 1));
return value * 4d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment