Skip to content

Instantly share code, notes, and snippets.

@Zepheus
Created December 6, 2013 15:12
Show Gist options
  • Save Zepheus/7826234 to your computer and use it in GitHub Desktop.
Save Zepheus/7826234 to your computer and use it in GitHub Desktop.
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