
On Wed, 2 Aug 2006 20:35:19 +0100, "Paul A Bristow" <pbristow@hetp.u-net.com> wrote:
| But...: are you serializing floating point values by means of | lexical_cast?
No - I meant 'stringizing'
Ok. It seems to me we need something along these lines (off the top of my head): #include "boost/limits.hpp" #define BOOST_is_ieee754(t) \ typedef char required [ \ std::numeric_limits<t>::is_iec559? 1 : -1 \ ] /**/ template <typename T> struct digits2 { enum { value = std::numeric_limits<T>::digits }; }; template <typename T> struct min_digits_10 { BOOST_is_ieee754(T); enum { value = 30103 * (digits2<T>::value - 1) / 100000 }; }; template <typename T> struct max_digits_10 { BOOST_is_ieee754(T); enum { value = 2 + 30103 * digits2<T>::value / 100000 }; } #undef BOOST_is_ieee754 -- [ Gennaro Prota, C++ developer for hire ]