main
Jan-Niclas Loosen 7 months ago
parent 16d44d3936
commit b2186d6019

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/Virtualenv" />
</content>
<orderEntry type="jdk" jdkName="C:\ProgramData\anaconda3" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="C:\Users\janni\anaconda3" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="C:\ProgramData\anaconda3" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="C:\Users\janni\anaconda3" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,16 @@
import sys
def greet(name):
print(f"Hello {name}")
def greet(name, message):
print(f"Hello {name}, {message}.")
try:
greet("Jan")
greet("Jan", "Wie gehts?")
except Exception as e:
print(e)
print(sys.float_info.epsilon)

@ -0,0 +1,19 @@
#include <iostream>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/special_functions/factorials.hpp>
namespace mp = boost::multiprecision;
mp::cpp_dec_float_1000 calc(const mp::cpp_dec_float_1000& const_value) {
mp::cpp_dec_float_1000 sum = 0;
for (int k = 1; k <= 10000; ++k) {
sum += pow(const_value, k) / boost::math::factorial<mp::cpp_dec_float_1000>(k);
}
return sum;
}
int main() {
mp::cpp_dec_float_1000 result = calc(log(mp::cpp_dec_float_1000(2));
std::cout << result << std::endl;
return 0;
}

@ -0,0 +1,14 @@
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)))
Loading…
Cancel
Save