You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
328 B
14 lines
328 B
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)))
|