
Paul A Bristow said: (by the date of Wed, 15 Mar 2006 20:15:10 -0000)
std::stringstream stream; double num; stream << std::setprecision(3 + std::numeric_limits<double>::digits * 3030/10000); stream << orig_value; stream >> num; // <<<<<<<<<< This is where I believe it goes wrong, sometimes, by one 1 bit :-((
so orig_value != num.
try following modifications in above code. If you still get a mistake by one bit, then .... well, I'd be very surprised. #include <boost/lexical_cast.hpp> std::stringstream stream; double num; stream << boost::lexical_cast<std::string>(orig_value); std::string tmp; stream >> tmp; num=boost::lexical_cast<double>(tmp); -- Janek Kozicki |