sh-5.2$ cat main.cpp
#include <iostream>
#include <limits>
#include <boost/multiprecision/cpp_dec_float.hpp>
using std::cin, std::cout, std::endl;
using std::numeric_limits;
using std::setprecision;
using boost::multiprecision::cpp_dec_float_100;
int main() {
size_t count; cin >> count;
cpp_dec_float_100 result, temp;
for(size_t i = 0; i < count; ++i) {
cin >> temp; result += temp;
}
cout << setprecision(numeric_limits<cpp_dec_float_100>::max_digits10);
cout << result << endl;
return 0;
}
sh-5.2$ ./main
10
0.999999999
0.000000001
-0.999999999
-0.000000001
99999999.999999999
99999999.999999999
99999999.999999999
0.000000002
-99999999.999999999
99999999.999999999
299999999.999999999
sh-5.2$
|