Skip to content

Instantly share code, notes, and snippets.

@MartinHeinz
Created September 10, 2022 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinHeinz/e6072dba0d5d62c5f80512109667975a to your computer and use it in GitHub Desktop.
Save MartinHeinz/e6072dba0d5d62c5f80512109667975a to your computer and use it in GitHub Desktop.
from decimal import *
def exp(x):
getcontext().prec += 2
i, lasts, s, fact, num = 0, 0, 1, 1, 1
while s != lasts:
lasts = s
i += 1
fact *= i
num *= x
s += num / fact
getcontext().prec -= 2
return +s
exp(Decimal(3000))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment