-
-
Save MartinHeinz/e6072dba0d5d62c5f80512109667975a to your computer and use it in GitHub Desktop.
This file contains 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
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