
Caleb Epstein wrote:
Note that boost::lexical_cast uses a precision of std::numeric_limits<T>::digits10 + 1 in its T-to-string conversions. For double, this is 16 which would probably explain the mismatch on the 17th significant digit on two separate platforms.
so it looks like lexical_cast has a bug (repeated) as well then see Paul Bristow's comment earlier, here is the code in lexical_cast.hpp. lexical_stream() { stream.unsetf(std::ios::skipws); if(std::numeric_limits<Target>::is_specialized) stream.precision(std::numeric_limits<Target>::digits10 + 1); else if(std::numeric_limits<Source>::is_specialized) stream.precision(std::numeric_limits<Source>::digits10 + 1); } Should both be tweaked to add the extra digits: stream.precision(2+std::numeric_limits<Target>::digits * 3010/10000); and stream.precision(2+std::numeric_limits<Source>::digits * 3010/10000); or am I missing the boat on my quick inspection Kevin -- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |