id summary reporter owner description type status milestone component version severity resolution keywords cc 10639 lexical_cast(string) wrong in C++11 richard.kreckel@… Antony Polukhin "It's a well-known fact that printing a double precision floating-point number to 17 decimal digits is enough to recover the original double precision number (c.f. Theorem 15 in David Goldberg's ""What Every Computer Scientist Should Know About Floating-Point Arithmetic""). This useful property has been broken somewhere between Boost 1.40 and Boost 1.55 if the program is compiled with -std=c++11 or -std=c++14 (GCC or CLang compiler switches). Here is a test program which should print the same number three times: {{{ #include #include #include #include #include int main() { double x = 1.0316536643319239e-255; std::printf(""x == %.17g\n"", x); std::string s = (boost::format(""%.17g"") % x).str(); std::printf(""s == %s\n"", s.c_str()); double y = boost::lexical_cast(s); // ERROR std::printf(""y == %.17g\n"", y); if (x != y) { std::cout << ""x and y are "" << boost::math::float_distance(x, y) << "" ULP apart"" << std::endl; return 1; } return 0; } }}} However, with Boost 1.55 or 1.56 it prints: {{{ x == 1.0316536643319239e-255 s == 1.0316536643319239e-255 y == 1.031653664331924e-255 x and y are 1 ULP apart }}} I'm testing this on an AMD64 machine running Linux with both G++ 4.9.1 and CLang 3.5.0. In both cases, the compiler switch -std=c++11 or -std=c++14 has to be set in order to trigger the problem." Bugs closed Boost 1.58.0 lexical_cast Boost 1.56.0 Problem fixed pbristow@…