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.

19 lines
565 B

#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;
}