Created
December 6, 2013 15:12
-
-
Save Zepheus/7826234 to your computer and use it in GitHub Desktop.
Calculates Pi through Taylor expansion or Arctan.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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