
-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Robert Ramey Sent: Thursday, August 08, 2013 5:26 PM To: boost@lists.boost.org Subject: Re: [boost] [serialization] How are floating point values handled?
But maybe it is. In anycase it looks like I should be using max_digits10 instead of digits10+2 in anycase.
Yes - the trouble is that not all platforms provide max_digits10 - it took 5 years before the first ones did, and then Microsoft got one of the constants values wrong, so another couple of years passed before anyone could use it! BOOST_NO_CXX11_NUMERIC_LIMITS tells if you std::numeric_limits<T>::max_digits10 is NOT supported. But the Kahan formula William Kahan says http://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF always works 2 + std::numeric_limits<Target>::digits * 3010/10000; so you are always safe to use that. HTH Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com