
Hi all, The test below fails: #include <iostream> #include <boost/lexical_cast.hpp> int main(int argc, char* argv[]) { std::string s; try { double d = std::numeric_limits <double> ::max(); s = boost::lexical_cast <std::string> (d); } catch (const boost::bad_lexical_cast&) { std::cout << "double to std::string fails" << std::endl; } try { double dd = boost::lexical_cast <double> (s); } catch (const boost::bad_lexical_cast&) { std::cout << "std::string to double fails" << std::endl; } return 0; } To solve this issue I propose to alter the line "stream.precision(std::numeric_limits<Target>::digits10 + 1" in the constructor for lexical_stream into "stream.precision(std::numeric_limits<Target>::digits10 - 1". Regards, P. Sliepenbeek --------------------------------- Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.

On Fri, 05 Oct 2007 15:35:00 +0300, Peter Sliepenbeek <peter_sliepenbeek@yahoo.com> wrote:
[...]The test below fails:
You might want to file a bug report to http://svn.boost.org/trac/boost. Boris
participants (2)
-
Boris
-
Peter Sliepenbeek