Skip to content

Instantly share code, notes, and snippets.

@pablovv72
Created December 10, 2018 12:37
Show Gist options
  • Save pablovv72/1c660b48dbcb13aea5c4a1f15f6a735d to your computer and use it in GitHub Desktop.
Save pablovv72/1c660b48dbcb13aea5c4a1f15f6a735d to your computer and use it in GitHub Desktop.
from time import *
i = 1
pi = 0
ti = time()
while True:
pi = pi + 4 / i - 4 / (i + 2) # método 1
i += 4
if time() - ti >= 5:
print(f'\tPI ≈ {pi:.35f} => método 1\n' + \
f'\tCICLOS => {int((i - 1) / 4e6)}M')
ti = time()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment