UNI_Python/ext_02/test.py
2024-03-01 12:32:09 +01:00

15 lines
329 B
Python

import math
from decimal import Decimal, getcontext
__author__ = "Jan-Niclas Loosen"
def calc(const):
summe = Decimal(0)
for k in range(1, 100):
summe += (Decimal(const) ** k) / math.factorial(k)
return summe
getcontext().prec = 1000 # Set the precision for Decimal calculations
print(calc(math.log(2)))