Index: basic_text_oprimitive.hpp =================================================================== --- basic_text_oprimitive.hpp (revision 86498) +++ basic_text_oprimitive.hpp (working copy) @@ -136,7 +136,7 @@ // we'll get a compile time error. This is meant to automatically // support synthesized types which support floating point // operations. Also it should handle compiler dependent types - // such long double. Due to John Maddoc. + // such long double. Due to John Maddock. template struct is_float { @@ -156,12 +156,16 @@ boost::serialization::throw_exception( archive_exception(archive_exception::output_stream_error) ); +#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS + const unsigned int digits = std::numeric_limits::max_digits10; +#else // The formulae for the number of decimla digits required is given in // http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf // which is derived from Kahan's paper: // http://http.cs.berkley.edu/~wkahan/ieee754status/ieee754.ps - const unsigned int digits = (std::numeric_limits::digits * 3010) / 10000; - os << std::setprecision(digits); + const unsigned int digits = std::numeric_limits::radix == 2 ? (std::numeric_limits::digits * 3010) / 10000 : std::numeric_limits::digits10; +#endif + os << std::setprecision(digits) << std::scientific; os << t; }