Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74562 - in sandbox/big_number: boost/math/big_number libs/math/test
From: john_at_[hidden]
Date: 2011-09-25 08:35:41


Author: johnmaddock
Date: 2011-09-25 08:35:40 EDT (Sun, 25 Sep 2011)
New Revision: 74562
URL: http://svn.boost.org/trac/boost/changeset/74562

Log:
Fix remaining GCC test failures, plus a few warnings.
Text files modified:
   sandbox/big_number/boost/math/big_number/mpfr.hpp | 4 ----
   sandbox/big_number/libs/math/test/test_arithmetic.cpp | 26 ++++++++++++++++++--------
   2 files changed, 18 insertions(+), 12 deletions(-)

Modified: sandbox/big_number/boost/math/big_number/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/math/big_number/mpfr.hpp (original)
+++ sandbox/big_number/boost/math/big_number/mpfr.hpp 2011-09-25 08:35:40 EDT (Sun, 25 Sep 2011)
@@ -67,13 +67,9 @@
       while(i)
       {
          mpfr_set_ui(t, static_cast<unsigned>(i & mask), GMP_RNDN);
- long e;
- const char* ps = mpfr_get_str (0, &e, 10, 0, t, GMP_RNDN);
          if(shift)
             mpfr_mul_2exp(t, t, shift, GMP_RNDN);
- ps = mpfr_get_str (0, &e, 10, 0, t, GMP_RNDN);
          mpfr_add(m_data, m_data, t, GMP_RNDN);
- ps = mpfr_get_str (0, &e, 10, 0, m_data, GMP_RNDN);
          shift += std::numeric_limits<unsigned>::digits;
          i >>= std::numeric_limits<unsigned>::digits;
       }

Modified: sandbox/big_number/libs/math/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/math/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/math/test/test_arithmetic.cpp 2011-09-25 08:35:40 EDT (Sun, 25 Sep 2011)
@@ -382,10 +382,15 @@
    BOOST_TEST(n2 == Real(n2));
    BOOST_TEST(n3 == Real(n3));
    BOOST_TEST(n4 == Real(n4));
- BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), 3 * std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
+#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
+ Num tol = 10 * std::numeric_limits<Num>::epsilon();
+#else
+ Num tol = 0;
+#endif
+ BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), tol);
+ BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), 0);
+ BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), 0);
+ BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), 0);
    // Assignment:
    Real r(0);
    BOOST_TEST(r != n1);
@@ -479,10 +484,15 @@
    BOOST_TEST(n3 == Real(n3));
    BOOST_TEST(n4 == Real(n4));
    std::cout << Real(n1).str(0, boost::is_floating_point<Num>::value) << std::endl;
- BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), 3 * std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
- BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), std::numeric_limits<Num>::epsilon());
+#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
+ Num tol = 10 * std::numeric_limits<Num>::epsilon();
+#else
+ Num tol = 0;
+#endif
+ BOOST_TEST_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, boost::is_floating_point<Num>::value)), tol);
+ BOOST_TEST_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, boost::is_floating_point<Num>::value)), 0);
+ BOOST_TEST_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, boost::is_floating_point<Num>::value)), 0);
+ BOOST_TEST_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, boost::is_floating_point<Num>::value)), 0);
    // Assignment:
    Real r(0);
    BOOST_TEST(r != n1);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk