Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5758: Boost.Test Floating-point comparison diagnostic output does not support radix 10
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-09 13:50:10
#5758: Boost.Test Floating-point comparison diagnostic output does not support
radix 10
--------------------------------------+-------------------------------------
Reporter: pbristow | Owner: rogeeff
Type: Support Requests | Status: closed
Milestone: Boost 1.48.0 | Component: test
Version: Boost Development Trunk | Severity: Problem
Resolution: fixed | Keywords: floating point radix 10 decimal precision
--------------------------------------+-------------------------------------
Comment (by pbristow):
Using John Maddock and Christopher Kormanyos mutliprecision currently
under review
BOOST_AUTO_TEST_CASE(cpp_loopback_test_message)
{ // Loopback.
using namespace boost::multiprecision;
cpp_dec_float_100 a = "1.";
cpp_dec_float_100 b = "1.";
b += 1e-100;
BOOST_CHECK_EQUAL(a, b);
} // BOOST_AUTO_TEST_CASE(cpp_loopback_test_message)
Gives this misleading message
error : in "cpp_loopback_test_message": check a == b failed [1 != 1]
else if ( std::numeric_limits<T>::is_specialized &&
std::numeric_limits<T>::radix == 10 )
// adding this to cater for radix 10
{
#ifdef BOOST_NO_NUMERIC_LIMITS_LOWEST
// No support for std::numeric_limits<double>::max_digits10;
// so guess that a couple of guard digits more than digits10 will display
any difference.
ostr.precision( 2 + std::numeric_limits<T>::digits10 );
#else
// std::numeric_limits<double>::max_digits10; IS supported.
// Any noisy or guard digits needed to display any difference are
included in max_digits10.
ostr.precision( std::numeric_limits<T>::max_digits10 );
#endif
}
// else if T is not specialized, then will just get the default
precision of 6 digits.
gives this more helpful mesage
in "cpp_loopback_test_message": check a == b failed [1 !=
1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000001999]
BOOST_NO_NUMERIC_LIMITS_LOWEST is a proxy for support of max_digits10.
And seems to work in tests using Boost.Math.
At present only MSVC 10 and some gcc test platforms support max_digits10.
Sandia clang darwin trunk c++11 seems to fail with and without check for
BOOST_NO_NUMERIC_LIMITS_LOWEST.
Please tell me immediately of any problem this revised version causes.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5758#comment:6> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC