Boost logo

Boost :

Subject: [boost] Is there a macro to test if std::numerc_limits<>::max_digits10 is supported by a platform?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2012-06-14 07:00:12


A proposed (but not reverted) fix for

Trac #5758: Boost.Test Floating-point comparison diagnostic output does not support radix 10

        if( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 10 )
            ostr.precision( 2 + std::numeric_limits<T>::max_digits10);
            // Assume that max_digits10 is provided for all radix 10 as they are quite new,
            // and anyway Kahan formula will not work for decimal.

has caused trouble on platforms that do not yet support

std::numeric_limits<T>::max_digits10

We need a macro perhaps BOOST_NO_NUMERIC_LIMITS_ MAX_DIGITS10

that will prevent the compiler seeing this code if max_digits10 is not supported.

Do I need to add a default for all compilers

# define BOOST_NO_NUMERIC_LIMITS_ MAX_DIGITS10

and then undefine for compilers that DO support
 
#if defined (_MSC_VER >=1600) || (... other compilers that DO support)
# undef BOOST_NO_NUMERIC_LIMITS_ MAX_DIGITS10
#endif

Can anyone advise compiler versions or library versions that DO support max_digits10?

Suggestions?

Paul

PS maxdigits10 will become more useful generally as the wrong value in float in MSVC 2011 seems to
be corrected in

Microsoft Visual Studio Ultimate 2012 RC 11.0.50522.1

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk