Skip to content

Instantly share code, notes, and snippets.

@catupper
Created May 20, 2011 08:11
Show Gist options
  • Save catupper/982537 to your computer and use it in GitHub Desktop.
Save catupper/982537 to your computer and use it in GitHub Desktop.
import decimal
decimal.getcontext().prec = 100
dd=decima.Decimal
def pi(x):
xx=dd(1)
xt=0
for a in range(x):
xt+=dd(4)/xx
xt*=dd(-1)
xx+=dd(2)
return abs(xt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment