19 lines
565 B
C++
19 lines
565 B
C++
#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;
|
|
} |