When the current locale uses ',' as the radix character instead of '.', the result of cpp_dec_float<>::convert_to<double>() is incorrect. Test program: --8<-- #include <iostream> #include <boost/multiprecision/cpp_dec_float.hpp> #include <locale.h> #include <langinfo.h> int main() { double x1 = 987.654; boost::multiprecision::number< boost::multiprecision::cpp_dec_float<24>, boost::multiprecision::et_off> x2 = x1; setlocale(LC_NUMERIC, "C"); std::cout << "radixchar is " << nl_langinfo(RADIXCHAR) << std::endl; std::cout << x1 << std::endl; std::cout << x2 << std::endl; std::cout << x2.convert_to<double>() << std::endl << std::endl; setlocale(LC_NUMERIC, "sv_SE.utf8"); std::cout << "radixchar is " << nl_langinfo(RADIXCHAR) << std::endl; std::cout << x1 << std::endl; std::cout << x2 << std::endl; std::cout << x2.convert_to<double>() << std::endl << std::endl; return 0; } --8<-- Output: --8<-- radixchar is . 987.654 987.654 987.654 radixchar is , 987.654 987.654 9 ---8<--- The expected result is the same number is printed in all six cases. Upstreams issue and fix: https://github.com/boostorg/multiprecision/issues/464
Created attachment 793847 [details, diff] Upstreams patch, with filenames modified to match the unified boost dist
Sorry, I'd meant to apply this earlier, although will likely be sorted w/ 1.80 now.