
13 Apr
2016
13 Apr
'16
9:32 p.m.
Consider the following code: #include <boost/multiprecision/cpp_bin_float.hpp> #include <iostream> int main() { typedef boost::multiprecision::cpp_bin_float_quad float128_t; float128_t f1(1e-9); float128_t f2("1e-9"); std::cout << std::setprecision(std::numeric_limits<float128_t>::max_digits10); std::cout << f1 << std::endl; std::cout << f2 << std::endl; return 0; } I'm getting as output: 1.000000000000000062281591457779856419e-09 9.999999999999999999999999999999999325e-10 The conversion of the double literal is not as expected. On wand box: http://melpon.org/wandbox/permlink/uSGNQZAEEytmb3ao Is this a bug? If not, what would be the correct way to get my expected behavior? Thanks, Rob Conde