Last active
August 16, 2016 17:45
-
-
Save ericjang/ba22adbd9f13ca1fcfc40ed8c520f566 to your computer and use it in GitHub Desktop.
Compute's Pi using Leibniz formula
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
r = 0.0 | |
for n in range(1000000): | |
r += (-1.0)**n/(2.0*n+1.0) | |
print(4*r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why did I just get the print result
3.14159165359
...