Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81654 - in trunk: boost/multiprecision boost/multiprecision/cpp_int boost/multiprecision/detail libs/multiprecision/performance libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-12-01 11:19:27


Author: johnmaddock
Date: 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
New Revision: 81654
URL: http://svn.boost.org/trac/boost/changeset/81654

Log:
Refactor test_arithmetic.cpp into lots of small files for reduced dependencies.
Changed use of __forceinline to release builds only.
Added:
   trunk/libs/multiprecision/test/test_arithmetic.hpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_ab_1.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_ab_2.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_ab_3.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_backend_concept.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_1.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_2.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_3.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_1.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_10.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_11.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_12.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_13.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_14.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_15.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_16.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_17.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_18.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_2.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_3.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_4.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_5.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_6.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_7.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_8.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_9.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_cpp_int_br.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpf.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpf_50.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpfr.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpfr_50.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpq.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpz.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_mpz_br.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_tommath.cpp (contents, props changed)
   trunk/libs/multiprecision/test/test_arithmetic_tommath_br.cpp (contents, props changed)
Removed:
   trunk/libs/multiprecision/test/test_arithmetic.cpp
Text files modified:
   trunk/boost/multiprecision/cpp_int.hpp | 202 +++++++++++++++---------------
   trunk/boost/multiprecision/cpp_int/add.hpp | 30 ++--
   trunk/boost/multiprecision/cpp_int/bitwise.hpp | 14 +-
   trunk/boost/multiprecision/cpp_int/comparison.hpp | 60 ++++----
   trunk/boost/multiprecision/cpp_int/divide.hpp | 30 ++--
   trunk/boost/multiprecision/cpp_int/misc.hpp | 18 +-
   trunk/boost/multiprecision/cpp_int/multiply.hpp | 32 ++--
   trunk/boost/multiprecision/detail/no_et_ops.hpp | 132 ++++++++++----------
   trunk/boost/multiprecision/detail/number_base.hpp | 6
   trunk/boost/multiprecision/number.hpp | 114 ++++++++--------
   trunk/libs/multiprecision/performance/arithmetic_backend.hpp | 11 +
   trunk/libs/multiprecision/test/Jamfile.v2 | 258 ++++++---------------------------------
   12 files changed, 369 insertions(+), 538 deletions(-)

Modified: trunk/boost/multiprecision/cpp_int.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int.hpp (original)
+++ trunk/boost/multiprecision/cpp_int.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -204,27 +204,27 @@
    //
    // Direct construction:
    //
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
       : m_data(i), m_limbs(1), m_sign(false), m_internal(true) { }
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT
       : m_data(i), m_limbs(1), m_sign(i < 0), m_internal(true) { }
 #if defined(BOOST_LITTLE_ENDIAN)
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
       : m_data(i), m_limbs(i > max_limb_value ? 2 : 1), m_sign(false), m_internal(true) { }
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT
       : m_data(i), m_limbs(i < 0 ? (-i > max_limb_value ? 2 : 1) : (i > max_limb_value ? 2 : 1)),
         m_sign(i < 0), m_internal(true) { }
 #endif
    //
    // Helper functions for getting at our internal data, and manipulating storage:
    //
- BOOST_FORCEINLINE allocator_type& allocator() BOOST_NOEXCEPT { return *this; }
- BOOST_FORCEINLINE const allocator_type& allocator()const BOOST_NOEXCEPT { return *this; }
- BOOST_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
- BOOST_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; }
- BOOST_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; }
- BOOST_FORCEINLINE unsigned capacity()const BOOST_NOEXCEPT { return m_internal ? internal_limb_count : m_data.ld.capacity; }
- BOOST_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
+ BOOST_MP_FORCEINLINE allocator_type& allocator() BOOST_NOEXCEPT { return *this; }
+ BOOST_MP_FORCEINLINE const allocator_type& allocator()const BOOST_NOEXCEPT { return *this; }
+ BOOST_MP_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
+ BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; }
+ BOOST_MP_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; }
+ BOOST_MP_FORCEINLINE unsigned capacity()const BOOST_NOEXCEPT { return m_internal ? internal_limb_count : m_data.ld.capacity; }
+ BOOST_MP_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
    void sign(bool b) BOOST_NOEXCEPT
    {
       m_sign = b;
@@ -263,13 +263,13 @@
          m_limbs = new_size;
       }
    }
- BOOST_FORCEINLINE void normalize() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT
    {
       limb_pointer p = limbs();
       while((m_limbs-1) && !p[m_limbs - 1])--m_limbs;
    }
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT : m_data(), m_limbs(1), m_sign(false), m_internal(true) {}
- BOOST_FORCEINLINE cpp_int_base(const cpp_int_base& o) : allocator_type(o), m_limbs(0), m_internal(true)
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT : m_data(), m_limbs(1), m_sign(false), m_internal(true) {}
+ BOOST_MP_FORCEINLINE cpp_int_base(const cpp_int_base& o) : allocator_type(o), m_limbs(0), m_internal(true)
    {
       resize(o.size(), o.size());
       std::copy(o.limbs(), o.limbs() + o.size(), limbs());
@@ -311,7 +311,7 @@
       return *this;
    }
 #endif
- BOOST_FORCEINLINE ~cpp_int_base() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE ~cpp_int_base() BOOST_NOEXCEPT
    {
       if(!m_internal)
          allocator().deallocate(limbs(), capacity());
@@ -327,7 +327,7 @@
          m_sign = o.m_sign;
       }
    }
- BOOST_FORCEINLINE void negate() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void negate() BOOST_NOEXCEPT
    {
       m_sign = !m_sign;
       // Check for zero value:
@@ -337,11 +337,11 @@
             m_sign = false;
       }
    }
- BOOST_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
    {
       return m_sign;
    }
- BOOST_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
    {
       std::swap(m_data, o.m_data);
       std::swap(m_sign, o.m_sign);
@@ -415,14 +415,14 @@
    //
    // Direct construction:
    //
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
       : m_wrapper(i), m_limbs(1), m_sign(false) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT
       : m_wrapper(limb_type(i < 0 ? -i : i)), m_limbs(1), m_sign(i < 0) {}
 #if defined(BOOST_LITTLE_ENDIAN)
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
       : m_wrapper(i), m_limbs(i > max_limb_value ? 2 : 1), m_sign(false) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT
       : m_wrapper(double_limb_type(i < 0 ? -i : i)),
         m_limbs(i < 0 ? (-i > max_limb_value ? 2 : 1) : (i > max_limb_value ? 2 : 1)),
         m_sign(i < 0) {}
@@ -430,11 +430,11 @@
    //
    // Helper functions for getting at our internal data, and manipulating storage:
    //
- BOOST_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
- BOOST_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_wrapper.m_data; }
- BOOST_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_wrapper.m_data; }
- BOOST_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
- BOOST_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
+ BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_wrapper.m_data; }
+ BOOST_MP_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_wrapper.m_data; }
+ BOOST_MP_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
+ BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT
    {
       m_sign = b;
       // Check for zero value:
@@ -444,12 +444,12 @@
             m_sign = false;
       }
    }
- BOOST_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       m_limbs = static_cast<boost::uint16_t>((std::min)(new_size, internal_limb_count));
       detail::verify_new_size(m_limbs, min_size, checked_type());
    }
- BOOST_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       limb_pointer p = limbs();
       detail::verify_limb_mask(m_limbs == internal_limb_count, p[internal_limb_count-1], upper_limb_mask, checked_type());
@@ -458,8 +458,8 @@
       if((m_limbs == 1) && (!*p)) m_sign = false; // zero is always unsigned
    }
 
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_wrapper(limb_type(0u)), m_limbs(1), m_sign(false) {}
- BOOST_FORCEINLINE cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT : m_limbs(o.m_limbs), m_sign(o.m_sign)
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_wrapper(limb_type(0u)), m_limbs(1), m_sign(false) {}
+ BOOST_MP_FORCEINLINE cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT : m_limbs(o.m_limbs), m_sign(o.m_sign)
    {
       std::copy(o.limbs(), o.limbs() + o.size(), limbs());
    }
@@ -473,7 +473,7 @@
          m_sign = o.m_sign;
       }
    }
- BOOST_FORCEINLINE void negate() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void negate() BOOST_NOEXCEPT
    {
       m_sign = !m_sign;
       // Check for zero value:
@@ -483,11 +483,11 @@
             m_sign = false;
       }
    }
- BOOST_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
    {
       return m_sign;
    }
- BOOST_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
    {
       for(unsigned i = 0; i < (std::max)(size(), o.size()); ++i)
          std::swap(m_wrapper.m_data[i], o.m_wrapper.m_data[i]);
@@ -549,30 +549,30 @@
    //
    // Direct construction:
    //
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT
       : m_wrapper(i), m_limbs(1) {}
- BOOST_FORCEINLINE cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_wrapper(limb_type(i < 0 ? -i : i)), m_limbs(1) { if(i < 0) negate(); }
 #ifdef BOOST_LITTLE_ENDIAN
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
       : m_wrapper(i), m_limbs(i > max_limb_value ? 2 : 1) {}
- BOOST_FORCEINLINE cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_wrapper(double_limb_type(i < 0 ? -i : i)), m_limbs(i < 0 ? (-i > max_limb_value ? 2 : 1) : (i > max_limb_value ? 2 : 1)) { if(i < 0) negate(); }
 #endif
    //
    // Helper functions for getting at our internal data, and manipulating storage:
    //
- BOOST_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
- BOOST_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_wrapper.m_data; }
- BOOST_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_wrapper.m_data; }
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; }
- BOOST_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked)) { if(b) negate(); }
- BOOST_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE unsigned size()const BOOST_NOEXCEPT { return m_limbs; }
+ BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_wrapper.m_data; }
+ BOOST_MP_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_wrapper.m_data; }
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; }
+ BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked)) { if(b) negate(); }
+ BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       m_limbs = (std::min)(new_size, internal_limb_count);
       detail::verify_new_size(m_limbs, min_size, checked_type());
    }
- BOOST_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       limb_pointer p = limbs();
       detail::verify_limb_mask(m_limbs == internal_limb_count, p[internal_limb_count-1], upper_limb_mask, checked_type());
@@ -580,15 +580,15 @@
       while((m_limbs-1) && !p[m_limbs - 1])--m_limbs;
    }
 
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT
       : m_wrapper(limb_type(0u)), m_limbs(1) {}
- BOOST_FORCEINLINE cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
       : m_limbs(o.m_limbs)
    {
       std::copy(o.limbs(), o.limbs() + o.size(), limbs());
    }
    //~cpp_int_base() BOOST_NOEXCEPT {}
- BOOST_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
    {
       if(this != &o)
       {
@@ -619,11 +619,11 @@
       normalize();
       eval_increment(static_cast<cpp_int_backend<MinBits, MinBits, unsigned_magnitude, Checked, void>& >(*this));
    }
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool isneg()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool isneg()const BOOST_NOEXCEPT
    {
       return false;
    }
- BOOST_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
    {
       for(unsigned i = 0; i < (std::max)(size(), o.size()); ++i)
          std::swap(m_wrapper.m_data[i], o.m_wrapper.m_data[i]);
@@ -674,7 +674,7 @@
    typedef mpl::int_<Checked> checked_type;
 protected:
    BOOST_STATIC_CONSTANT(unsigned, limb_bits = sizeof(local_limb_type) * CHAR_BIT);
- BOOST_STATIC_CONSTANT(local_limb_type, limb_mask = (MinBits < limb_bits) ? ((~local_limb_type(0)) >> (limb_bits - MinBits)) : (~local_limb_type(0)));
+ BOOST_STATIC_CONSTANT(local_limb_type, limb_mask = (MinBits < limb_bits) ? local_limb_type((local_limb_type(~local_limb_type(0))) >> (limb_bits - MinBits)) : local_limb_type(~local_limb_type(0)));
 private:
    local_limb_type m_data;
    bool m_sign;
@@ -708,31 +708,31 @@
    // Direct construction:
    //
    template <class SI>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(i < 0 ? static_cast<local_limb_type>(-i) : static_cast<local_limb_type>(i)), m_sign(i < 0) {}
    template <class SI>
- BOOST_FORCEINLINE cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(i < 0 ? static_cast<local_limb_type>(-i) : static_cast<local_limb_type>(i)), m_sign(i < 0) { check_in_range(i); }
    template <class UI>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(i)), m_sign(false) {}
    template <class UI>
- BOOST_FORCEINLINE cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == checked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == checked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(i)), m_sign(false) { check_in_range(i); }
    template <class F>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(F i, typename enable_if_c<is_floating_point<F>::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(F i, typename enable_if_c<is_floating_point<F>::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(std::fabs(i))), m_sign(i < 0) {}
    template <class F>
- BOOST_FORCEINLINE cpp_int_base(F i, typename enable_if_c<is_floating_point<F>::value && (Checked == checked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(F i, typename enable_if_c<is_floating_point<F>::value && (Checked == checked)>::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(std::fabs(i))), m_sign(i < 0) { check_in_range(i); }
    //
    // Helper functions for getting at our internal data, and manipulating storage:
    //
- BOOST_FORCEINLINE BOOST_CONSTEXPR unsigned size()const BOOST_NOEXCEPT { return 1; }
- BOOST_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return &m_data; }
- BOOST_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return &m_data; }
- BOOST_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
- BOOST_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR unsigned size()const BOOST_NOEXCEPT { return 1; }
+ BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return &m_data; }
+ BOOST_MP_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return &m_data; }
+ BOOST_MP_FORCEINLINE bool sign()const BOOST_NOEXCEPT { return m_sign; }
+ BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT
    {
       m_sign = b;
       // Check for zero value:
@@ -741,11 +741,11 @@
          m_sign = false;
       }
    }
- BOOST_FORCEINLINE void resize(unsigned new_size, unsigned min_size)
+ BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size)
    {
       detail::verify_new_size(2, min_size, checked_type());
    }
- BOOST_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       if(!m_data)
          m_sign = false; // zero is always unsigned
@@ -753,16 +753,16 @@
       m_data &= limb_mask;
    }
 
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_data(0), m_sign(false) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_data(0), m_sign(false) {}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
       : m_data(o.m_data), m_sign(o.m_sign) {}
    //~cpp_int_base() BOOST_NOEXCEPT {}
- BOOST_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
    {
       m_data = o.m_data;
       m_sign = o.m_sign;
    }
- BOOST_FORCEINLINE void negate() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void negate() BOOST_NOEXCEPT
    {
       m_sign = !m_sign;
       // Check for zero value:
@@ -771,11 +771,11 @@
          m_sign = false;
       }
    }
- BOOST_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool isneg()const BOOST_NOEXCEPT
    {
       return m_sign;
    }
- BOOST_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
    {
       std::swap(m_sign, o.m_sign);
       std::swap(m_data, o.m_data);
@@ -823,10 +823,10 @@
          BOOST_THROW_EXCEPTION(std::range_error("The argument to an unsigned cpp_int constructor was negative."));
    }
    template <class T, int C, bool B>
- BOOST_FORCEINLINE void check_in_range(T, const mpl::int_<C>&, const mpl::bool_<B>&){}
+ BOOST_MP_FORCEINLINE void check_in_range(T, const mpl::int_<C>&, const mpl::bool_<B>&){}
 
    template <class T>
- BOOST_FORCEINLINE void check_in_range(T val)
+ BOOST_MP_FORCEINLINE void check_in_range(T val)
    {
       check_in_range(val, checked_type(), is_signed<T>());
    }
@@ -836,19 +836,19 @@
    // Direct construction:
    //
    template <class SI>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(i < 0 ? 1 + ~static_cast<local_limb_type>(-i) : static_cast<local_limb_type>(i)) {}
    template <class SI>
- BOOST_FORCEINLINE cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename enable_if_c<is_signed<SI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(i < 0 ? 1 + ~static_cast<local_limb_type>(-i) : static_cast<local_limb_type>(i)) { check_in_range(i); }
    template <class UI>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(i)) {}
    template <class UI>
- BOOST_FORCEINLINE cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename enable_if_c<is_unsigned<UI>::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(i)) { check_in_range(i); }
    template <class F>
- BOOST_FORCEINLINE cpp_int_base(F i, typename enable_if<is_floating_point<F> >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE cpp_int_base(F i, typename enable_if<is_floating_point<F> >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked))
       : m_data(static_cast<local_limb_type>(std::fabs(i)))
    {
       check_in_range(i);
@@ -858,34 +858,34 @@
    //
    // Helper functions for getting at our internal data, and manipulating storage:
    //
- BOOST_FORCEINLINE BOOST_CONSTEXPR unsigned size()const BOOST_NOEXCEPT { return 1; }
- BOOST_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return &m_data; }
- BOOST_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return &m_data; }
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; }
- BOOST_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR unsigned size()const BOOST_NOEXCEPT { return 1; }
+ BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return &m_data; }
+ BOOST_MP_FORCEINLINE const_limb_pointer limbs()const BOOST_NOEXCEPT { return &m_data; }
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; }
+ BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       if(b)
          negate();
    }
- BOOST_FORCEINLINE void resize(unsigned new_size, unsigned min_size)
+ BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size)
    {
       detail::verify_new_size(2, min_size, checked_type());
    }
- BOOST_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       detail::verify_limb_mask(true, m_data, limb_mask, checked_type());
       m_data &= limb_mask;
    }
 
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_data(0) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base() : m_data(0) {}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT
       : m_data(o.m_data) {}
    //~cpp_int_base() BOOST_NOEXCEPT {}
- BOOST_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void assign(const cpp_int_base& o) BOOST_NOEXCEPT
    {
       m_data = o.m_data;
    }
- BOOST_FORCEINLINE void negate() BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void negate() BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       if(Checked == checked)
       {
@@ -894,11 +894,11 @@
       m_data = ~m_data;
       ++m_data;
    }
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool isneg()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool isneg()const BOOST_NOEXCEPT
    {
       return false;
    }
- BOOST_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_swap(cpp_int_base& o) BOOST_NOEXCEPT
    {
       std::swap(m_data, o.m_data);
    }
@@ -961,17 +961,17 @@
>::type float_types;
    typedef mpl::int_<Checked> checked_type;
 
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend() BOOST_NOEXCEPT{}
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value) : base_type(o) {}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend() BOOST_NOEXCEPT{}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value) : base_type(o) {}
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(cpp_int_backend&& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(cpp_int_backend&& o) BOOST_NOEXCEPT
       : base_type(static_cast<base_type&&>(o)) {}
 #endif
    //
    // Direct construction from arithmetic type:
    //
    template <class Arg>
- BOOST_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(Arg i, typename enable_if_c<is_allowed_cpp_int_base_conversion<Arg, base_type>::value >::type const* = 0)BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(Arg i, typename enable_if_c<is_allowed_cpp_int_base_conversion<Arg, base_type>::value >::type const* = 0)BOOST_NOEXCEPT_IF((Checked == unchecked))
       : base_type(i) {}
 
 private:
@@ -1169,13 +1169,13 @@
       this->sign(other.sign());
    }
 #endif
- BOOST_FORCEINLINE cpp_int_backend& operator = (const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
+ BOOST_MP_FORCEINLINE cpp_int_backend& operator = (const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
    {
       this->assign(o);
       return *this;
    }
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- BOOST_FORCEINLINE cpp_int_backend& operator = (cpp_int_backend&& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
+ BOOST_MP_FORCEINLINE cpp_int_backend& operator = (cpp_int_backend&& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
    {
       *static_cast<base_type*>(this) = static_cast<base_type&&>(o);
       return *this;
@@ -1197,13 +1197,13 @@
       this->sign(val < 0);
       this->normalize();
    }
- BOOST_FORCEINLINE void do_assign_arithmetic(limb_type i, const mpl::false_&) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void do_assign_arithmetic(limb_type i, const mpl::false_&) BOOST_NOEXCEPT
    {
       this->resize(1, 1);
       *this->limbs() = i;
       this->sign(false);
    }
- BOOST_FORCEINLINE void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_NOEXCEPT_IF((Checked == unchecked))
+ BOOST_MP_FORCEINLINE void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_NOEXCEPT_IF((Checked == unchecked))
    {
       this->resize(1, 1);
       *this->limbs() = static_cast<limb_type>(std::abs(i));
@@ -1285,7 +1285,7 @@
    }
 public:
    template <class Arithmetic>
- BOOST_FORCEINLINE cpp_int_backend& operator = (Arithmetic val)
+ BOOST_MP_FORCEINLINE cpp_int_backend& operator = (Arithmetic val)
    {
       do_assign_arithmetic(val, trivial_tag());
       return *this;
@@ -1445,7 +1445,7 @@
       do_assign_string(s, trivial_tag());
       return *this;
    }
- BOOST_FORCEINLINE void swap(cpp_int_backend& o) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void swap(cpp_int_backend& o) BOOST_NOEXCEPT
    {
       this->do_swap(o);
    }
@@ -1720,7 +1720,7 @@
       return 0;
    }
    template <class Arithmetic>
- BOOST_FORCEINLINE typename enable_if<is_arithmetic<Arithmetic>, int>::type compare(Arithmetic i)const
+ BOOST_MP_FORCEINLINE typename enable_if<is_arithmetic<Arithmetic>, int>::type compare(Arithmetic i)const
    {
       // braindead version:
       cpp_int_backend t;

Modified: trunk/boost/multiprecision/cpp_int/add.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/add.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/add.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -241,7 +241,7 @@
 // Now the actual functions called by the front end, all of which forward to one of the above:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_add(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -263,7 +263,7 @@
    add_unsigned(result, a, b);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_add(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    if(result.sign())
@@ -274,7 +274,7 @@
       add_unsigned(result, result, o);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_add(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -288,7 +288,7 @@
       add_unsigned(result, a, o);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_add(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -299,7 +299,7 @@
       eval_add(result, static_cast<limb_type>(o));
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_add(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -313,7 +313,7 @@
       result = a;
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -326,7 +326,7 @@
       subtract_unsigned(result, result, o);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -342,7 +342,7 @@
    }
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -356,7 +356,7 @@
    }
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -374,7 +374,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_increment(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    static const limb_type one = 1;
@@ -386,7 +386,7 @@
       eval_add(result, one);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_decrement(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    static const limb_type one = 1;
@@ -398,7 +398,7 @@
       eval_subtract(result, one);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -406,7 +406,7 @@
    eval_subtract(result, result, o);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3, unsigned MaxBits3, cpp_integer_type SignType3, cpp_int_check_type Checked3, class Allocator3>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
    eval_subtract(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -451,7 +451,7 @@
 }
 // Simple version for two unsigned arguments:
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
@@ -490,7 +490,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value

Modified: trunk/boost/multiprecision/cpp_int/bitwise.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/bitwise.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/bitwise.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -163,7 +163,7 @@
 struct bit_xor{ limb_type operator()(limb_type a, limb_type b)const BOOST_NOEXCEPT { return a ^ b; } };
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_bitwise_and(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -172,7 +172,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_bitwise_or(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -181,7 +181,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_bitwise_xor(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -190,7 +190,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_complement(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -203,7 +203,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value >::type
    eval_complement(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -354,7 +354,7 @@
 // Over agin for trivial cpp_int's:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class T>
-BOOST_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type
    eval_left_shift(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, T s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    *result.limbs() = detail::checked_left_shift(*result.limbs(), s, typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
@@ -362,7 +362,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class T>
-BOOST_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type
    eval_right_shift(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, T s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    // Nothing to check here... just make sure we don't invoke undefined behavior:

Modified: trunk/boost/multiprecision/cpp_int/comparison.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/comparison.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/comparison.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -21,7 +21,7 @@
 // Start with non-trivial cpp_int's:
 //
 template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value,
       bool
>::type
@@ -32,7 +32,7 @@
       && std::equal(a.limbs(), a.limbs() + a.size(), b.limbs());
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
       && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value,
       bool
@@ -44,7 +44,7 @@
       && std::equal(a.limbs(), a.limbs() + a.size(), b.limbs());
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -54,7 +54,7 @@
       && (*a.limbs() == b);
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
@@ -65,7 +65,7 @@
       && (*a.limbs() == static_cast<limb_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -74,7 +74,7 @@
       && (*a.limbs() == b);
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
@@ -83,7 +83,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -118,7 +118,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -128,7 +128,7 @@
    return *a.limbs() < b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
@@ -137,7 +137,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -174,7 +174,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) BOOST_NOEXCEPT
@@ -184,7 +184,7 @@
    return *a.limbs() > b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
@@ -195,7 +195,7 @@
 // And again for trivial cpp_ints:
 //
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::value eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -203,7 +203,7 @@
    return (a.sign() == b.sign()) && (*a.limbs() == *b.limbs());
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::value eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -211,7 +211,7 @@
    return *a.limbs() == *b.limbs();
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -219,7 +219,7 @@
    return !a.sign() && (*a.limbs() == b);
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
@@ -229,7 +229,7 @@
    return (a.sign() == (b < 0)) && (*a.limbs() == static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -237,7 +237,7 @@
    return *a.limbs() == b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
@@ -255,7 +255,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -265,7 +265,7 @@
    return a.sign() ? *a.limbs() > *b.limbs() : *a.limbs() < *b.limbs();
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -273,7 +273,7 @@
    return *a.limbs() < *b.limbs();
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -283,7 +283,7 @@
    return *a.limbs() < b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
@@ -295,7 +295,7 @@
    return a.sign() ? (*a.limbs() > static_cast<ui_type>(abs(b))) : (*a.limbs() < static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -303,7 +303,7 @@
    return *a.limbs() < b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
@@ -321,7 +321,7 @@
 }
 
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -331,7 +331,7 @@
    return a.sign() ? *a.limbs() < *b.limbs() : *a.limbs() > *b.limbs();
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) BOOST_NOEXCEPT
@@ -339,7 +339,7 @@
    return *a.limbs() > *b.limbs();
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -349,7 +349,7 @@
    return *a.limbs() > b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
@@ -361,7 +361,7 @@
    return a.sign() ? (*a.limbs() < static_cast<ui_type>(abs(b))) : (*a.limbs() > static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) BOOST_NOEXCEPT
@@ -369,7 +369,7 @@
    return *a.limbs() > b;
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class S>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
       is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT

Modified: trunk/boost/multiprecision/cpp_int/divide.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/divide.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/divide.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -439,7 +439,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3, unsigned MaxBits3, cpp_integer_type SignType3, cpp_int_check_type Checked3, class Allocator3>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -451,7 +451,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -462,7 +462,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -475,7 +475,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& b)
@@ -486,7 +486,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       limb_type b)
@@ -497,7 +497,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_divide(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       signed_limb_type b)
@@ -508,7 +508,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3, unsigned MaxBits3, cpp_integer_type SignType3, cpp_int_check_type Checked3, class Allocator3>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -519,7 +519,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a, limb_type b)
@@ -528,7 +528,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -538,7 +538,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& b)
@@ -549,7 +549,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       limb_type b)
@@ -560,7 +560,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_modulus(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       signed_limb_type b)
@@ -574,7 +574,7 @@
 // Over again for trivial cpp_int's:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && (is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
@@ -591,7 +591,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
@@ -607,7 +607,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
>::type

Modified: trunk/boost/multiprecision/cpp_int/misc.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/misc.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/misc.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -31,10 +31,10 @@
    }
 }
 template <class R, class CppInt>
-void check_in_range(const CppInt& /*val*/, const mpl::int_<unchecked>&) BOOST_NOEXCEPT {}
+inline void check_in_range(const CppInt& /*val*/, const mpl::int_<unchecked>&) BOOST_NOEXCEPT {}
 
-void check_is_negative(const mpl::true_&) BOOST_NOEXCEPT {}
-void check_is_negative(const mpl::false_&)
+inline void check_is_negative(const mpl::true_&) BOOST_NOEXCEPT {}
+inline void check_is_negative(const mpl::false_&)
 {
    BOOST_THROW_EXCEPTION(std::range_error("Attempt to assign a negative value to an unsigned type."));
 }
@@ -88,19 +88,19 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, bool>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, bool>::type
    eval_is_zero(const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& val) BOOST_NOEXCEPT
 {
    return (val.size() == 1) && (val.limbs()[0] == 0);
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, int>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, int>::type
    eval_get_sign(const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& val) BOOST_NOEXCEPT
 {
    return eval_is_zero(val) ? 0 : val.sign() ? -1 : 1;
 }
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_abs(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    result = val;
@@ -238,7 +238,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class Integer>
-BOOST_FORCEINLINE typename enable_if_c<is_signed<Integer>::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, Integer>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_signed<Integer>::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, Integer>::type
    eval_integer_modulus(const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& x, Integer val)
 {
    BOOST_MP_USING_ABS
@@ -250,14 +250,14 @@
 // Now again for trivial backends:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_gcd(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& a, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& b) BOOST_NOEXCEPT
 {
    *result.limbs() = boost::math::gcd(*a.limbs(), *b.limbs());
 }
 // This one is only enabled for unchecked cpp_int's, for checked int's we need the checking in the default version:
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && (Checked1 == unchecked)>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && (Checked1 == unchecked)>::type
    eval_lcm(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& a, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    *result.limbs() = boost::math::lcm(*a.limbs(), *b.limbs());

Modified: trunk/boost/multiprecision/cpp_int/multiply.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/multiply.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/multiply.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -154,7 +154,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_multiply(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
@@ -163,14 +163,14 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_multiply(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    eval_multiply(result, result, val);
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_multiply(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -188,14 +188,14 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_multiply(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    eval_multiply(result, result, val);
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
    eval_multiply(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
@@ -211,7 +211,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_multiply(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const signed_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    eval_multiply(result, result, val);
@@ -243,7 +243,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
    eval_multiply(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const signed_double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    eval_multiply(result, result, val);
@@ -253,7 +253,7 @@
 // Now over again for trivial cpp_int's:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && (is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
@@ -269,7 +269,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
>::type
@@ -282,7 +282,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && (is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
@@ -299,7 +299,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
          is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
          && is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
>::type
@@ -316,7 +316,7 @@
 // Special routines for multiplying two integers to obtain a multiprecision result:
 //
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
             !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
>::type
    eval_multiply(
@@ -360,7 +360,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
             !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
>::type
    eval_multiply(
@@ -399,7 +399,7 @@
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1,
           unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
-BOOST_FORCEINLINE typename enable_if_c<
+BOOST_MP_FORCEINLINE typename enable_if_c<
             !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
             && is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value
             && is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value
@@ -415,7 +415,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class SI>
-BOOST_FORCEINLINE typename enable_if_c<is_signed<SI>::value && (sizeof(SI) <= sizeof(signed_double_limb_type) / 2)>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_signed<SI>::value && (sizeof(SI) <= sizeof(signed_double_limb_type) / 2)>::type
    eval_multiply(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       SI a, SI b)
@@ -424,7 +424,7 @@
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class UI>
-BOOST_FORCEINLINE typename enable_if_c<is_unsigned<UI>::value && (sizeof(UI) <= sizeof(signed_double_limb_type) / 2)>::type
+BOOST_MP_FORCEINLINE typename enable_if_c<is_unsigned<UI>::value && (sizeof(UI) <= sizeof(signed_double_limb_type) / 2)>::type
    eval_multiply(
       cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
       UI a, UI b)

Modified: trunk/boost/multiprecision/detail/no_et_ops.hpp
==============================================================================
--- trunk/boost/multiprecision/detail/no_et_ops.hpp (original)
+++ trunk/boost/multiprecision/detail/no_et_ops.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -20,7 +20,7 @@
 // NOTE: these operators have to be defined after the methods in default_ops.hpp.
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator - (const number<B, et_off>& v)
+BOOST_MP_FORCEINLINE number<B, et_off> operator - (const number<B, et_off>& v)
 {
    BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
    number<B, et_off> result(v);
@@ -28,7 +28,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ~ (const number<B, et_off>& v)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ~ (const number<B, et_off>& v)
 {
    number<B, et_off> result;
    eval_complement(result.backend(), v.backend());
@@ -38,7 +38,7 @@
 // Addition:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator + (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator + (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_add;
@@ -46,7 +46,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator + (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -55,7 +55,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator + (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -67,7 +67,7 @@
 // Subtraction:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator - (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator - (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_subtract;
@@ -75,7 +75,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator - (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -84,7 +84,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator - (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -96,7 +96,7 @@
 // Multiply:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator * (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator * (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_multiply;
@@ -104,7 +104,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator * (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -113,7 +113,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator * (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -125,7 +125,7 @@
 // divide:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator / (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator / (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_divide;
@@ -133,7 +133,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator / (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -142,7 +142,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator / (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -154,7 +154,7 @@
 // modulus:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator % (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator % (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_modulus;
@@ -162,7 +162,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator % (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -171,7 +171,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator % (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -183,7 +183,7 @@
 // Bitwise or:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator | (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator | (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_bitwise_or;
@@ -191,7 +191,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator | (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -200,7 +200,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator | (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -212,7 +212,7 @@
 // Bitwise xor:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ^ (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ^ (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_bitwise_xor;
@@ -220,7 +220,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator ^ (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -229,7 +229,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator ^ (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -241,7 +241,7 @@
 // Bitwise and:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator & (const number<B, et_off>& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator & (const number<B, et_off>& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
    using default_ops::eval_bitwise_and;
@@ -249,7 +249,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator & (const number<B, et_off>& a, const V& b)
 {
    number<B, et_off> result;
@@ -258,7 +258,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator & (const V& a, const number<B, et_off>& b)
 {
    number<B, et_off> result;
@@ -270,7 +270,7 @@
 // shifts:
 //
 template <class B, class I>
-BOOST_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
    operator << (const number<B, et_off>& a, const I& b)
 {
    number<B, et_off> result(a);
@@ -280,7 +280,7 @@
    return BOOST_MP_MOVE(result);
 }
 template <class B, class I>
-BOOST_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
    operator >> (const number<B, et_off>& a, const I& b)
 {
    number<B, et_off> result(a);
@@ -303,14 +303,14 @@
 // semantics help a great deal in return by value, so performance is still pretty good...
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& v)
+BOOST_MP_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& v)
 {
    BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
    v.backend().negate();
    return static_cast<number<B, et_off>&&>(v);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ~ (number<B, et_off>&& v)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ~ (number<B, et_off>&& v)
 {
    eval_complement(v.backend(), v.backend());
    return static_cast<number<B, et_off>&&>(v);
@@ -319,28 +319,28 @@
 // Addition:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator + (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator + (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_add;
    eval_add(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator + (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator + (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_add;
    eval_add(b.backend(), a.backend());
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator + (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator + (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_add;
    eval_add(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator + (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_add;
@@ -348,7 +348,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator + (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_add;
@@ -359,14 +359,14 @@
 // Subtraction:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_subtract;
    eval_subtract(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE typename enable_if<is_signed_number<B>, number<B, et_off> >::type operator - (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE typename enable_if<is_signed_number<B>, number<B, et_off> >::type operator - (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_subtract;
    eval_subtract(b.backend(), a.backend());
@@ -374,14 +374,14 @@
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator - (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_subtract;
    eval_subtract(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator - (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_subtract;
@@ -389,7 +389,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if_c<(is_compatible_arithmetic_type<V, number<B, et_off> >::value && is_signed_number<B>::value), number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if_c<(is_compatible_arithmetic_type<V, number<B, et_off> >::value && is_signed_number<B>::value), number<B, et_off> >::type
    operator - (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_subtract;
@@ -401,28 +401,28 @@
 // Multiply:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator * (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator * (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_multiply;
    eval_multiply(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator * (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator * (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_multiply;
    eval_multiply(b.backend(), a.backend());
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator * (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator * (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_multiply;
    eval_multiply(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator * (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_multiply;
@@ -430,7 +430,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator * (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_multiply;
@@ -441,14 +441,14 @@
 // divide:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator / (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator / (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_divide;
    eval_divide(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator / (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_divide;
@@ -459,14 +459,14 @@
 // modulus:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator % (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator % (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_modulus;
    eval_modulus(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator % (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_modulus;
@@ -477,28 +477,28 @@
 // Bitwise or:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator | (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator | (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_bitwise_or;
    eval_bitwise_or(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator | (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator | (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_or;
    eval_bitwise_or(b.backend(), a.backend());
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator | (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator | (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_or;
    eval_bitwise_or(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator | (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_bitwise_or;
@@ -506,7 +506,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator | (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_or;
@@ -517,28 +517,28 @@
 // Bitwise xor:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ^ (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ^ (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_bitwise_xor;
    eval_bitwise_xor(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ^ (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ^ (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_xor;
    eval_bitwise_xor(b.backend(), a.backend());
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator ^ (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator ^ (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_xor;
    eval_bitwise_xor(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator ^ (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_bitwise_xor;
@@ -546,7 +546,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator ^ (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_xor;
@@ -557,28 +557,28 @@
 // Bitwise and:
 //
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator & (number<B, et_off>&& a, const number<B, et_off>& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator & (number<B, et_off>&& a, const number<B, et_off>& b)
 {
    using default_ops::eval_bitwise_and;
    eval_bitwise_and(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator & (const number<B, et_off>& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator & (const number<B, et_off>& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_and;
    eval_bitwise_and(b.backend(), a.backend());
    return static_cast<number<B, et_off>&&>(b);
 }
 template <class B>
-BOOST_FORCEINLINE number<B, et_off> operator & (number<B, et_off>&& a, number<B, et_off>&& b)
+BOOST_MP_FORCEINLINE number<B, et_off> operator & (number<B, et_off>&& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_and;
    eval_bitwise_and(a.backend(), b.backend());
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class V>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator & (number<B, et_off>&& a, const V& b)
 {
    using default_ops::eval_bitwise_and;
@@ -586,7 +586,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class V, class B>
-BOOST_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
    operator & (const V& a, number<B, et_off>&& b)
 {
    using default_ops::eval_bitwise_and;
@@ -597,7 +597,7 @@
 // shifts:
 //
 template <class B, class I>
-BOOST_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
    operator << (number<B, et_off>&& a, const I& b)
 {
    using default_ops::eval_left_shift;
@@ -605,7 +605,7 @@
    return static_cast<number<B, et_off>&&>(a);
 }
 template <class B, class I>
-BOOST_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
+BOOST_MP_FORCEINLINE typename enable_if<is_integral<I>, number<B, et_off> >::type
    operator >> (number<B, et_off>&& a, const I& b)
 {
    using default_ops::eval_right_shift;

Modified: trunk/boost/multiprecision/detail/number_base.hpp
==============================================================================
--- trunk/boost/multiprecision/detail/number_base.hpp (original)
+++ trunk/boost/multiprecision/detail/number_base.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -19,6 +19,12 @@
 # pragma warning(pop)
 #endif
 
+#if defined(NDEBUG) && !defined(_DEBUG)
+# define BOOST_MP_FORCEINLINE BOOST_FORCEINLINE
+#else
+# define BOOST_MP_FORCEINLINE inline
+#endif
+
 namespace boost{ namespace multiprecision{
 
 enum expression_template_option

Modified: trunk/boost/multiprecision/number.hpp
==============================================================================
--- trunk/boost/multiprecision/number.hpp (original)
+++ trunk/boost/multiprecision/number.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -40,10 +40,10 @@
    typedef number<Backend, ExpressionTemplates> self_type;
 public:
    typedef Backend backend_type;
- BOOST_FORCEINLINE BOOST_CONSTEXPR number() BOOST_NOEXCEPT_IF(noexcept(Backend())) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number& e) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(e.m_backend){}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number() BOOST_NOEXCEPT_IF(noexcept(Backend())) {}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& e) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(e.m_backend){}
    template <class V>
- BOOST_FORCEINLINE number(const V& v, typename enable_if_c<
+ BOOST_MP_FORCEINLINE number(const V& v, typename enable_if_c<
             (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
             && !is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
             && !detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
@@ -52,15 +52,15 @@
       m_backend = canonical_value(v);
    }
    template <class V>
- BOOST_FORCEINLINE BOOST_CONSTEXPR number(const V& v, typename enable_if_c<
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const V& v, typename enable_if_c<
             is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
             && !detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
>::type* = 0)
       : m_backend(canonical_value(v)) {}
- BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number& e, unsigned digits10)
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& e, unsigned digits10)
       : m_backend(e.m_backend, digits10){}
    template <class V>
- explicit BOOST_FORCEINLINE number(const V& v, typename enable_if_c<
+ explicit BOOST_MP_FORCEINLINE number(const V& v, typename enable_if_c<
             (boost::is_arithmetic<V>::value || is_same<std::string, V>::value || is_convertible<V, const char*>::value)
             && !detail::is_explicitly_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
             && detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
@@ -69,7 +69,7 @@
       m_backend = canonical_value(v);
    }
    template <class V>
- explicit BOOST_FORCEINLINE BOOST_CONSTEXPR number(const V& v, typename enable_if_c<
+ explicit BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const V& v, typename enable_if_c<
             detail::is_explicitly_convertible<typename detail::canonical<V, Backend>::type, Backend>::value
             && (detail::is_restricted_conversion<typename detail::canonical<V, Backend>::type, Backend>::value
                 || !is_convertible<typename detail::canonical<V, Backend>::type, Backend>::value)
@@ -88,10 +88,10 @@
    }
    */
    template<expression_template_option ET>
- BOOST_FORCEINLINE BOOST_CONSTEXPR number(const number<Backend, ET>& val) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(val.backend()) {}
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number<Backend, ET>& val) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast<const Backend&>(std::declval<Backend>())))) : m_backend(val.backend()) {}
 
    template <class Other, expression_template_option ET>
- BOOST_FORCEINLINE number(const number<Other, ET>& val,
+ BOOST_MP_FORCEINLINE number(const number<Other, ET>& val,
          typename enable_if_c<(boost::is_convertible<Other, Backend>::value && !detail::is_restricted_conversion<Other, Backend>::value)>::type* = 0)
       BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<Other>()))
       : m_backend(val.backend()) {}
@@ -107,20 +107,20 @@
       detail::generic_interconvert(backend(), val.backend(), number_category<Backend>(), number_category<Other>());
    }
    template <class Other, expression_template_option ET>
- explicit BOOST_FORCEINLINE number(const number<Other, ET>& val, typename enable_if_c<
+ explicit BOOST_MP_FORCEINLINE number(const number<Other, ET>& val, typename enable_if_c<
          (detail::is_explicitly_convertible<Other, Backend>::value
             && (detail::is_restricted_conversion<Other, Backend>::value || !boost::is_convertible<Other, Backend>::value))
>::type* = 0) BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval<Other>())))
       : m_backend(val.backend()) {}
 
    template <class V>
- BOOST_FORCEINLINE number(V v1, V v2, typename enable_if<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> > >::type* = 0)
+ BOOST_MP_FORCEINLINE number(V v1, V v2, typename enable_if<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> > >::type* = 0)
    {
       using default_ops::assign_components;
       assign_components(m_backend, canonical_value(v1), canonical_value(v2));
    }
    template <class Other, expression_template_option ET>
- BOOST_FORCEINLINE number(const number<Other, ET>& v1, const number<Other, ET>& v2, typename enable_if<boost::is_convertible<Other, Backend> >::type* = 0)
+ BOOST_MP_FORCEINLINE number(const number<Other, ET>& v1, const number<Other, ET>& v2, typename enable_if<boost::is_convertible<Other, Backend> >::type* = 0)
    {
       using default_ops::assign_components;
       assign_components(m_backend, v1.backend(), v2.backend());
@@ -141,21 +141,21 @@
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator=(const number& e) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Backend&>(std::declval<Backend>())))
+ BOOST_MP_FORCEINLINE number& operator=(const number& e) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = static_cast<const Backend&>(std::declval<Backend>())))
    {
       m_backend = e.m_backend;
       return *this;
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_MP_FORCEINLINE typename enable_if<is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
       operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
    {
       m_backend = canonical_value(v);
       return *this;
    }
    template <class V>
- BOOST_FORCEINLINE number<Backend, ExpressionTemplates>& assign(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
+ BOOST_MP_FORCEINLINE number<Backend, ExpressionTemplates>& assign(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>() = std::declval<typename boost::multiprecision::detail::canonical<V, Backend>::type>()))
    {
       m_backend = canonical_value(v);
       return *this;
@@ -185,8 +185,8 @@
    }
 
 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- BOOST_FORCEINLINE BOOST_CONSTEXPR number(number&& r) BOOST_NOEXCEPT : m_backend(static_cast<Backend&&>(r.m_backend)){}
- BOOST_FORCEINLINE number& operator=(number&& r) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(number&& r) BOOST_NOEXCEPT : m_backend(static_cast<Backend&&>(r.m_backend)){}
+ BOOST_MP_FORCEINLINE number& operator=(number&& r) BOOST_NOEXCEPT
    {
       m_backend = static_cast<Backend&&>(r.m_backend);
       return *this;
@@ -351,14 +351,14 @@
    // execute the increment/decrement on destruction, but
    // correct implemetation will be tricky, so defered for now...
    //
- BOOST_FORCEINLINE number& operator++()
+ BOOST_MP_FORCEINLINE number& operator++()
    {
       using default_ops::eval_increment;
       eval_increment(m_backend);
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator--()
+ BOOST_MP_FORCEINLINE number& operator--()
    {
       using default_ops::eval_decrement;
       eval_decrement(m_backend);
@@ -382,7 +382,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<is_integral<V>, number&>::type operator <<= (V val)
+ BOOST_MP_FORCEINLINE typename enable_if<is_integral<V>, number&>::type operator <<= (V val)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The left-shift operation is only valid for integer types");
       detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), is_signed<V>());
@@ -391,7 +391,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<is_integral<V>, number&>::type operator >>= (V val)
+ BOOST_MP_FORCEINLINE typename enable_if<is_integral<V>, number&>::type operator >>= (V val)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The right-shift operation is only valid for integer types");
       detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), is_signed<V>());
@@ -399,7 +399,7 @@
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator /= (const self_type& e)
+ BOOST_MP_FORCEINLINE number& operator /= (const self_type& e)
    {
       do_divide(detail::expression<detail::terminal, self_type>(e), detail::terminal());
       return *this;
@@ -422,7 +422,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_MP_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
       operator/=(const V& v)
    {
       using default_ops::eval_divide;
@@ -430,7 +430,7 @@
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator&=(const self_type& e)
+ BOOST_MP_FORCEINLINE number& operator&=(const self_type& e)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise & operation is only valid for integer types");
       do_bitwise_and(detail::expression<detail::terminal, self_type>(e), detail::terminal());
@@ -456,7 +456,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_MP_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
       operator&=(const V& v)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise & operation is only valid for integer types");
@@ -465,7 +465,7 @@
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator|=(const self_type& e)
+ BOOST_MP_FORCEINLINE number& operator|=(const self_type& e)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise | operation is only valid for integer types");
       do_bitwise_or(detail::expression<detail::terminal, self_type>(e), detail::terminal());
@@ -491,7 +491,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_MP_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
       operator|=(const V& v)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise | operation is only valid for integer types");
@@ -500,7 +500,7 @@
       return *this;
    }
 
- BOOST_FORCEINLINE number& operator^=(const self_type& e)
+ BOOST_MP_FORCEINLINE number& operator^=(const self_type& e)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise ^ operation is only valid for integer types");
       do_bitwise_xor(detail::expression<detail::terminal, self_type>(e), detail::terminal());
@@ -524,7 +524,7 @@
    }
 
    template <class V>
- BOOST_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
+ BOOST_MP_FORCEINLINE typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
       operator^=(const V& v)
    {
       BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The bitwise ^ operation is only valid for integer types");
@@ -537,7 +537,7 @@
    //
    typedef bool (self_type::*unmentionable_type)()const;
 
- BOOST_FORCEINLINE operator unmentionable_type()const
+ BOOST_MP_FORCEINLINE operator unmentionable_type()const
    {
       return is_zero() ? 0 : &self_type::is_zero;
    }
@@ -545,19 +545,19 @@
    //
    // swap:
    //
- BOOST_FORCEINLINE void swap(self_type& other) BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE void swap(self_type& other) BOOST_NOEXCEPT
    {
       m_backend.swap(other.backend());
    }
    //
    // Zero and sign:
    //
- BOOST_FORCEINLINE bool is_zero()const
+ BOOST_MP_FORCEINLINE bool is_zero()const
    {
       using default_ops::eval_is_zero;
       return eval_is_zero(m_backend);
    }
- BOOST_FORCEINLINE int sign()const
+ BOOST_MP_FORCEINLINE int sign()const
    {
       using default_ops::eval_get_sign;
       return eval_get_sign(m_backend);
@@ -646,24 +646,24 @@
    //
    // Comparison:
    //
- BOOST_FORCEINLINE int compare(const number<Backend, ExpressionTemplates>& o)const
+ BOOST_MP_FORCEINLINE int compare(const number<Backend, ExpressionTemplates>& o)const
       BOOST_NOEXCEPT_IF(noexcept(std::declval<Backend>().compare(std::declval<Backend>())))
    {
       return m_backend.compare(o.m_backend);
    }
    template <class V>
- BOOST_FORCEINLINE typename enable_if<is_arithmetic<V>, int>::type compare(const V& o)const
+ BOOST_MP_FORCEINLINE typename enable_if<is_arithmetic<V>, int>::type compare(const V& o)const
    {
       using default_ops::eval_get_sign;
       if(o == 0)
          return eval_get_sign(m_backend);
       return m_backend.compare(canonical_value(o));
    }
- BOOST_FORCEINLINE Backend& backend() BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE Backend& backend() BOOST_NOEXCEPT
    {
       return m_backend;
    }
- BOOST_FORCEINLINE const Backend& backend()const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE const Backend& backend()const BOOST_NOEXCEPT
    {
       return m_backend;
    }
@@ -1555,23 +1555,23 @@
 
    // Tests if the expression contains a reference to *this:
    template <class Exp>
- BOOST_FORCEINLINE bool contains_self(const Exp& e)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool contains_self(const Exp& e)const BOOST_NOEXCEPT
    {
       return contains_self(e, typename Exp::arity());
    }
    template <class Exp>
- BOOST_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT
    {
       return is_realy_self(e.value());
    }
    template <class Exp>
- BOOST_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<1> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<1> const&)const BOOST_NOEXCEPT
    {
       typedef typename Exp::left_type child_type;
       return contains_self(e.left(), typename child_type::arity());
    }
    template <class Exp>
- BOOST_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<2> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<2> const&)const BOOST_NOEXCEPT
    {
       typedef typename Exp::left_type child0_type;
       typedef typename Exp::right_type child1_type;
@@ -1579,7 +1579,7 @@
          || contains_self(e.right(), typename child1_type::arity());
    }
    template <class Exp>
- BOOST_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<3> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE bool contains_self(const Exp& e, mpl::int_<3> const&)const BOOST_NOEXCEPT
    {
       typedef typename Exp::left_type child0_type;
       typedef typename Exp::middle_type child1_type;
@@ -1591,32 +1591,32 @@
 
    // Test if the expression is a reference to *this:
    template <class Exp>
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp& e)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp& e)const BOOST_NOEXCEPT
    {
       return is_self(e, typename Exp::arity());
    }
    template <class Exp>
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT
    {
       return is_realy_self(e.value());
    }
    template <class Exp, int v>
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp&, mpl::int_<v> const&)const BOOST_NOEXCEPT
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool is_self(const Exp&, mpl::int_<v> const&)const BOOST_NOEXCEPT
    {
       return false;
    }
 
    template <class Val>
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_realy_self(const Val&)const BOOST_NOEXCEPT{ return false; }
- BOOST_FORCEINLINE BOOST_CONSTEXPR bool is_realy_self(const self_type& v)const BOOST_NOEXCEPT{ return &v == this; }
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool is_realy_self(const Val&)const BOOST_NOEXCEPT{ return false; }
+ BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool is_realy_self(const self_type& v)const BOOST_NOEXCEPT{ return &v == this; }
 
- static BOOST_FORCEINLINE BOOST_CONSTEXPR const Backend& function_arg_value(const self_type& v) BOOST_NOEXCEPT { return v.backend(); }
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const Backend& function_arg_value(const self_type& v) BOOST_NOEXCEPT { return v.backend(); }
    template <class V>
- static BOOST_FORCEINLINE BOOST_CONSTEXPR const V& function_arg_value(const V& v) BOOST_NOEXCEPT { return v; }
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const V& function_arg_value(const V& v) BOOST_NOEXCEPT { return v; }
    template <class A1, class A2, class A3, class A4>
- static BOOST_FORCEINLINE const A1& function_arg_value(const detail::expression<detail::terminal, A1, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value(); }
+ static BOOST_MP_FORCEINLINE const A1& function_arg_value(const detail::expression<detail::terminal, A1, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value(); }
    template <class A2, class A3, class A4>
- static BOOST_FORCEINLINE BOOST_CONSTEXPR const Backend& function_arg_value(const detail::expression<detail::terminal, number<Backend>, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value().backend(); }
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const Backend& function_arg_value(const detail::expression<detail::terminal, number<Backend>, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value().backend(); }
    Backend m_backend;
 
 public:
@@ -1624,16 +1624,16 @@
    // These shouldn't really need to be public, or even member functions, but it makes implementing
    // the non-member operators way easier if they are:
    //
- static BOOST_FORCEINLINE BOOST_CONSTEXPR const Backend& canonical_value(const self_type& v) BOOST_NOEXCEPT { return v.m_backend; }
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const Backend& canonical_value(const self_type& v) BOOST_NOEXCEPT { return v.m_backend; }
    template <class B2, expression_template_option ET>
- static BOOST_FORCEINLINE BOOST_CONSTEXPR const B2& canonical_value(const number<B2, ET>& v) BOOST_NOEXCEPT { return v.backend(); }
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const B2& canonical_value(const number<B2, ET>& v) BOOST_NOEXCEPT { return v.backend(); }
    template <class V>
- static BOOST_FORCEINLINE BOOST_CONSTEXPR typename disable_if<is_same<typename detail::canonical<V, Backend>::type, V>, typename detail::canonical<V, Backend>::type>::type
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR typename disable_if<is_same<typename detail::canonical<V, Backend>::type, V>, typename detail::canonical<V, Backend>::type>::type
       canonical_value(const V& v) BOOST_NOEXCEPT { return static_cast<typename detail::canonical<V, Backend>::type>(v); }
    template <class V>
- static BOOST_FORCEINLINE BOOST_CONSTEXPR typename enable_if<is_same<typename detail::canonical<V, Backend>::type, V>, const V&>::type
+ static BOOST_MP_FORCEINLINE BOOST_CONSTEXPR typename enable_if<is_same<typename detail::canonical<V, Backend>::type, V>, const V&>::type
       canonical_value(const V& v) BOOST_NOEXCEPT { return v; }
- static BOOST_FORCEINLINE typename detail::canonical<std::string, Backend>::type canonical_value(const std::string& v) BOOST_NOEXCEPT { return v.c_str(); }
+ static BOOST_MP_FORCEINLINE typename detail::canonical<std::string, Backend>::type canonical_value(const std::string& v) BOOST_NOEXCEPT { return v.c_str(); }
 
 };
 
@@ -1676,7 +1676,7 @@
 }
 
 template <class Backend, expression_template_option ExpressionTemplates>
-BOOST_FORCEINLINE void swap(number<Backend, ExpressionTemplates>& a, number<Backend, ExpressionTemplates>& b)
+BOOST_MP_FORCEINLINE void swap(number<Backend, ExpressionTemplates>& a, number<Backend, ExpressionTemplates>& b)
 {
    a.swap(b);
 }

Modified: trunk/libs/multiprecision/performance/arithmetic_backend.hpp
==============================================================================
--- trunk/libs/multiprecision/performance/arithmetic_backend.hpp (original)
+++ trunk/libs/multiprecision/performance/arithmetic_backend.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -169,7 +169,7 @@
 inline typename disable_if_c<std::numeric_limits<Arithmetic>::has_infinity>::type eval_divide(arithmetic_backend<Arithmetic>& result, const arithmetic_backend<Arithmetic>& o)
 {
    if(!o.data())
- BOOST_THROW_EXCEPTION(std::runtime_error("Divide by zero"));
+ BOOST_THROW_EXCEPTION(std::overflow_error("Divide by zero"));
    result.data() /= o.data();
 }
 
@@ -193,7 +193,7 @@
    eval_divide(arithmetic_backend<Arithmetic>& result, const A2& o)
 {
    if(!o)
- BOOST_THROW_EXCEPTION(std::runtime_error("Divide by zero"));
+ BOOST_THROW_EXCEPTION(std::overflow_error("Divide by zero"));
    result.data() /= o;
 }
 template <class Arithmetic, class A2>
@@ -227,7 +227,7 @@
 inline typename disable_if_c<std::numeric_limits<Arithmetic>::has_infinity>::type eval_divide(arithmetic_backend<Arithmetic>& result, const arithmetic_backend<Arithmetic>& a, const arithmetic_backend<Arithmetic>& b)
 {
    if(!b.data())
- BOOST_THROW_EXCEPTION(std::runtime_error("Divide by zero"));
+ BOOST_THROW_EXCEPTION(std::overflow_error("Divide by zero"));
    result.data() = a.data() / b.data();
 }
 
@@ -251,7 +251,7 @@
    eval_divide(arithmetic_backend<Arithmetic>& result, const arithmetic_backend<Arithmetic>& a, const A2& b)
 {
    if(!b)
- BOOST_THROW_EXCEPTION(std::runtime_error("Divide by zero"));
+ BOOST_THROW_EXCEPTION(std::overflow_error("Divide by zero"));
    result.data() = a.data() / b;
 }
 template <class Arithmetic, class A2>
@@ -517,6 +517,9 @@
 
 namespace detail{
 
+template <class Backend>
+struct double_precision_type;
+
 template<class Arithmetic, boost::multiprecision::expression_template_option ET>
 struct double_precision_type<number<arithmetic_backend<Arithmetic>, ET> >
 {

Modified: trunk/libs/multiprecision/test/Jamfile.v2
==============================================================================
--- trunk/libs/multiprecision/test/Jamfile.v2 (original)
+++ trunk/libs/multiprecision/test/Jamfile.v2 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -33,7 +33,6 @@
 local enable-specfun = [ MATCH (--enable-specfun) : [ modules.peek : ARGV ] ] ;
 local disable-concepts = [ MATCH (--disable-concepts) : [ modules.peek : ARGV ] ] ;
 
-
 lib gmp ;
 lib mpfr ;
 
@@ -47,224 +46,47 @@
    TOMMATH = tommath ;
 }
 
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_BACKEND
- : test_arithmetic_backend_concept ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_DEC_FLOAT
- : test_arithmetic_cpp_dec_float ;
-
-run test_arithmetic.cpp gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPF_50
- [ check-target-builds ../config//has_gmp : : <build>no ]
- : test_arithmetic_mpf50 ;
+run test_arithmetic_backend_concept.cpp ;
 
-run test_arithmetic.cpp gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPF
- [ check-target-builds ../config//has_gmp : : <build>no ]
- : test_arithmetic_mpf ;
-
-run test_arithmetic.cpp gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPZ
- [ check-target-builds ../config//has_gmp : : <build>no ]
- : test_arithmetic_mpz ;
-
-run test_arithmetic.cpp gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPZ_BOOST_RATIONAL
- [ check-target-builds ../config//has_gmp : : <build>no ]
- : test_arithmetic_mpz_br ;
-
-run test_arithmetic.cpp gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPQ
- [ check-target-builds ../config//has_gmp : : <build>no ]
- : test_arithmetic_mpq ;
-
-run test_arithmetic.cpp mpfr gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPFR
- [ check-target-builds ../config//has_mpfr : : <build>no ]
- : test_arithmetic_mpfr ;
-
-run test_arithmetic.cpp mpfr gmp
- : # command line
- : # input files
- : # requirements
- <define>TEST_MPFR_50
- [ check-target-builds ../config//has_mpfr : : <build>no ]
- : test_arithmetic_mpfr_50 ;
-
-run test_arithmetic.cpp $(TOMMATH)
- : # command line
- : # input files
- : # requirements
- <define>TEST_TOMMATH
- [ check-target-builds ../config//has_tommath : : <build>no ]
- : test_arithmetic_tommath ;
-
-run test_arithmetic.cpp $(TOMMATH)
- : # command line
- : # input files
- : # requirements
- <define>TEST_TOMMATH_BOOST_RATIONAL
- [ check-target-builds ../config//has_tommath : : <build>no ]
- : test_arithmetic_tommath_br ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_1
- : test_arithmetic_cpp_int_1 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_2
- : test_arithmetic_cpp_int_2 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_3
- : test_arithmetic_cpp_int_3 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_4
- : test_arithmetic_cpp_int_4 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_5
- : test_arithmetic_cpp_int_5 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_6
- : test_arithmetic_cpp_int_6 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_7
- : test_arithmetic_cpp_int_7 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_8
- : test_arithmetic_cpp_int_8 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_9
- : test_arithmetic_cpp_int_9 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_10
- : test_arithmetic_cpp_int_10 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_11
- : test_arithmetic_cpp_int_11 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_12
- : test_arithmetic_cpp_int_12 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_13
- : test_arithmetic_cpp_int_13 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_14
- : test_arithmetic_cpp_int_14 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_15
- : test_arithmetic_cpp_int_15 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_16
- : test_arithmetic_cpp_int_16 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_17
- : test_arithmetic_cpp_int_17 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_18
- : test_arithmetic_cpp_int_18 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_CPP_INT_BR
- : test_arithmetic_cpp_int_br ;
+run test_arithmetic_cpp_dec_float_1.cpp ;
+run test_arithmetic_cpp_dec_float_2.cpp ;
+run test_arithmetic_cpp_dec_float_3.cpp ;
+
+run test_arithmetic_mpf_50.cpp gmp : : : [ check-target-builds ../config//has_gmp : : <build>no ] ;
+run test_arithmetic_mpf.cpp gmp : : : [ check-target-builds ../config//has_gmp : : <build>no ] ;
+run test_arithmetic_mpz.cpp gmp : : : [ check-target-builds ../config//has_gmp : : <build>no ] ;
+run test_arithmetic_mpz_br.cpp gmp : : : [ check-target-builds ../config//has_gmp : : <build>no ] ;
+run test_arithmetic_mpq.cpp gmp : : : [ check-target-builds ../config//has_gmp : : <build>no ] ;
+
+run test_arithmetic_mpfr.cpp mpfr gmp : : : [ check-target-builds ../config//has_mpfr : : <build>no ] ;
+run test_arithmetic_mpfr_50.cpp mpfr gmp : : : [ check-target-builds ../config//has_mpfr : : <build>no ] ;
+
+run test_arithmetic_tommath.cpp $(TOMMATH) : : : [ check-target-builds ../config//has_tommath : : <build>no ] ;
+run test_arithmetic_tommath_br.cpp $(TOMMATH) : : : [ check-target-builds ../config//has_tommath : : <build>no ] ;
+
+run test_arithmetic_cpp_int_1.cpp ;
+run test_arithmetic_cpp_int_2.cpp ;
+run test_arithmetic_cpp_int_3.cpp ;
+run test_arithmetic_cpp_int_4.cpp ;
+run test_arithmetic_cpp_int_5.cpp ;
+run test_arithmetic_cpp_int_6.cpp ;
+run test_arithmetic_cpp_int_7.cpp ;
+run test_arithmetic_cpp_int_8.cpp ;
+run test_arithmetic_cpp_int_9.cpp ;
+run test_arithmetic_cpp_int_10.cpp ;
+run test_arithmetic_cpp_int_11.cpp ;
+run test_arithmetic_cpp_int_12.cpp ;
+run test_arithmetic_cpp_int_13.cpp ;
+run test_arithmetic_cpp_int_14.cpp ;
+run test_arithmetic_cpp_int_15.cpp ;
+run test_arithmetic_cpp_int_16.cpp ;
+run test_arithmetic_cpp_int_17.cpp ;
+run test_arithmetic_cpp_int_18.cpp ;
+run test_arithmetic_cpp_int_br.cpp ;
+
+run test_arithmetic_ab_1.cpp ;
+run test_arithmetic_ab_2.cpp ;
+run test_arithmetic_ab_3.cpp ;
 
 run test_numeric_limits.cpp
         : # command line

Deleted: trunk/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- trunk/libs/multiprecision/test/test_arithmetic.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
+++ (empty file)
@@ -1,1865 +0,0 @@
-///////////////////////////////////////////////////////////////
-// Copyright 2011 John Maddock. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
-
-#ifdef _MSC_VER
-# define _SCL_SECURE_NO_WARNINGS
-#endif
-
-#ifdef TEST_VLD
-#include <vld.h>
-#endif
-
-#include <boost/math/special_functions/pow.hpp>
-#include <boost/math/common_factor_rt.hpp>
-#include "test.hpp"
-
-#if defined(TEST_ARITHMETIC_BACKEND)
-# include "../performance/arithmetic_backend.hpp"
-#endif
-#if defined(TEST_MPF_50) || defined(TEST_MPF) || defined(TEST_MPZ) || defined(TEST_MPQ) || defined(TEST_MPZ_BOOST_RATIONAL)
-#include <boost/multiprecision/gmp.hpp>
-#include <boost/multiprecision/rational_adapter.hpp>
-#endif
-#ifdef TEST_BACKEND
-#include <boost/multiprecision/concepts/mp_number_archetypes.hpp>
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
-#include <boost/multiprecision/cpp_dec_float.hpp>
-#endif
-#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
-#include <boost/multiprecision/mpfr.hpp>
-#endif
-#if defined(TEST_TOMMATH) || defined(TEST_TOMMATH_BOOST_RATIONAL)
-#include <boost/multiprecision/tommath.hpp>
-#include <boost/multiprecision/rational_adapter.hpp>
-#endif
-#if defined(TEST_CPP_INT_1) || defined(TEST_CPP_INT_2) || defined(TEST_CPP_INT_3) || defined(TEST_CPP_INT_4)\
- || defined(TEST_CPP_INT_5) || defined(TEST_CPP_INT_6) || defined(TEST_CPP_INT_7) || defined(TEST_CPP_INT_8)\
- || defined(TEST_CPP_INT_9) || defined(TEST_CPP_INT_10) || defined(TEST_CPP_INT_11) || defined(TEST_CPP_INT_12)\
- || defined(TEST_CPP_INT_13) || defined(TEST_CPP_INT_14) || defined(TEST_CPP_INT_15) || defined(TEST_CPP_INT_16)\
- || defined(TEST_CPP_INT_17) || defined(TEST_CPP_INT_18) || defined(TEST_CPP_INT_BR)
-#include <boost/multiprecision/cpp_int.hpp>
-#endif
-
-template <class T>
-struct is_boost_rational : public boost::mpl::false_{};
-
-#if defined(TEST_TOMMATH_BOOST_RATIONAL) || defined(TEST_MPZ_BOOST_RATIONAL)
-#include <boost/rational.hpp>
-
-#define NO_MIXED_OPS
-
-template <class T>
-struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_{};
-
-namespace boost{ namespace multiprecision{
-
-#ifdef TEST_TOMMATH_BOOST_RATIONAL
-template<>
-struct number_category<rational<tom_int> > : public mpl::int_<number_kind_rational> {};
-#endif
-#ifdef TEST_MPZ_BOOST_RATIONAL
-template<>
-struct number_category<rational<mpz_int> > : public mpl::int_<number_kind_rational> {};
-#endif
-
-}}
-
-#endif
-
-#ifdef BOOST_MSVC
-// warning C4127: conditional expression is constant
-#pragma warning(disable:4127)
-#endif
-
-
-bool isfloat(float){ return true; }
-bool isfloat(double){ return true; }
-bool isfloat(long double){ return true; }
-template <class T> bool isfloat(T){ return false; }
-
-namespace detail{
-
-template<class tag, class Arg1, class Arg2, class Arg3, class Arg4>
-typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type
- abs(boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> const& v)
-{
- typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type result_type;
- return v < 0 ? result_type(-v) : result_type(v);
-}
-
-}
-
-template <class T>
-struct is_twos_complement_integer : public boost::mpl::true_ {};
-
-#ifdef TEST_TOMMATH
-template <>
-struct is_twos_complement_integer<boost::multiprecision::tom_int> : public boost::mpl::false_ {};
-#endif
-#if defined(TEST_CPP_INT_1) || defined(TEST_CPP_INT_2) || defined(TEST_CPP_INT_3) || defined(TEST_CPP_INT_4)\
- || defined(TEST_CPP_INT_5) || defined(TEST_CPP_INT_6) || defined(TEST_CPP_INT_7) || defined(TEST_CPP_INT_8)\
- || defined(TEST_CPP_INT_9) || defined(TEST_CPP_INT_10) || defined(TEST_CPP_INT_11) || defined(TEST_CPP_INT_12)\
- || defined(TEST_CPP_INT_13) || defined(TEST_CPP_INT_14) || defined(TEST_CPP_INT_15) || defined(TEST_CPP_INT_16)\
- || defined(TEST_CPP_INT_17) || defined(TEST_CPP_INT_18) || defined(TEST_CPP_INT_BR)
-template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
-struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
-#endif
-
-template <class T>
-struct related_type
-{
- typedef T type;
-};
-
-#ifdef TEST_MPQ
-template <>
-struct related_type<boost::multiprecision::mpq_rational>
-{
- typedef boost::multiprecision::mpz_int type;
-};
-#endif
-#if defined(TEST_MPF_50) || defined(TEST_MPF)
-template <unsigned D>
-struct related_type<boost::multiprecision::number< boost::multiprecision::gmp_float<D> > >
-{
- typedef boost::multiprecision::number< boost::multiprecision::gmp_float<D/2> > type;
-};
-template <>
-struct related_type<boost::multiprecision::mpf_float >
-{
- typedef boost::multiprecision::mpz_int type;
-};
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
-template <unsigned D>
-struct related_type<boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D> > >
-{
- typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D/2> > type;
-};
-#endif
-#if defined(TEST_MPFR_50) || defined(TEST_MPFR)
-template <unsigned D>
-struct related_type<boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D> > >
-{
- typedef boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D/2> > type;
-};
-#endif
-#if defined(TEST_CPP_INT_1) || defined(TEST_CPP_INT_2) || defined(TEST_CPP_INT_3) || defined(TEST_CPP_INT_4)\
- || defined(TEST_CPP_INT_5) || defined(TEST_CPP_INT_6) || defined(TEST_CPP_INT_7) || defined(TEST_CPP_INT_8)\
- || defined(TEST_CPP_INT_9) || defined(TEST_CPP_INT_10) || defined(TEST_CPP_INT_11) || defined(TEST_CPP_INT_12)\
- || defined(TEST_CPP_INT_13) || defined(TEST_CPP_INT_14) || defined(TEST_CPP_INT_15) || defined(TEST_CPP_INT_16)\
- || defined(TEST_CPP_INT_17) || defined(TEST_CPP_INT_18) || defined(TEST_CPP_INT_BR)
-template <>
-struct related_type<boost::multiprecision::cpp_int>
-{
- typedef boost::multiprecision::int256_t type;
-};
-template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
-struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
-{
- typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
-};
-#endif
-template <class Real, class Val>
-void test_comparisons(Val, Val, const boost::mpl::false_)
-{}
-
-int normalize_compare_result(int r)
-{
- return r > 0 ? 1 : r < 0 ? -1 : 0;
-}
-
-template <class Real, class Val>
-void test_comparisons(Val a, Val b, const boost::mpl::true_)
-{
- Real r1(a);
- Real r2(b);
- Real z(1);
-
- int cr = a < b ? -1 : a > b ? 1 : 0;
-
- BOOST_CHECK_EQUAL(r1 == r2, a == b);
- BOOST_CHECK_EQUAL(r1 != r2, a != b);
- BOOST_CHECK_EQUAL(r1 <= r2, a <= b);
- BOOST_CHECK_EQUAL(r1 < r2, a < b);
- BOOST_CHECK_EQUAL(r1 >= r2, a >= b);
- BOOST_CHECK_EQUAL(r1 > r2, a > b);
-
- BOOST_CHECK_EQUAL(r1 == b, a == b);
- BOOST_CHECK_EQUAL(r1 != b, a != b);
- BOOST_CHECK_EQUAL(r1 <= b, a <= b);
- BOOST_CHECK_EQUAL(r1 < b, a < b);
- BOOST_CHECK_EQUAL(r1 >= b, a >= b);
- BOOST_CHECK_EQUAL(r1 > b, a > b);
-
- BOOST_CHECK_EQUAL(a == r2, a == b);
- BOOST_CHECK_EQUAL(a != r2, a != b);
- BOOST_CHECK_EQUAL(a <= r2, a <= b);
- BOOST_CHECK_EQUAL(a < r2, a < b);
- BOOST_CHECK_EQUAL(a >= r2, a >= b);
- BOOST_CHECK_EQUAL(a > r2, a > b);
-
- BOOST_CHECK_EQUAL(r1*z == r2, a == b);
- BOOST_CHECK_EQUAL(r1*z != r2, a != b);
- BOOST_CHECK_EQUAL(r1*z <= r2, a <= b);
- BOOST_CHECK_EQUAL(r1*z < r2, a < b);
- BOOST_CHECK_EQUAL(r1*z >= r2, a >= b);
- BOOST_CHECK_EQUAL(r1*z > r2, a > b);
-
- BOOST_CHECK_EQUAL(r1 == r2*z, a == b);
- BOOST_CHECK_EQUAL(r1 != r2*z, a != b);
- BOOST_CHECK_EQUAL(r1 <= r2*z, a <= b);
- BOOST_CHECK_EQUAL(r1 < r2*z, a < b);
- BOOST_CHECK_EQUAL(r1 >= r2*z, a >= b);
- BOOST_CHECK_EQUAL(r1 > r2*z, a > b);
-
- BOOST_CHECK_EQUAL(r1*z == r2*z, a == b);
- BOOST_CHECK_EQUAL(r1*z != r2*z, a != b);
- BOOST_CHECK_EQUAL(r1*z <= r2*z, a <= b);
- BOOST_CHECK_EQUAL(r1*z < r2*z, a < b);
- BOOST_CHECK_EQUAL(r1*z >= r2*z, a >= b);
- BOOST_CHECK_EQUAL(r1*z > r2*z, a > b);
-
- BOOST_CHECK_EQUAL(r1*z == b, a == b);
- BOOST_CHECK_EQUAL(r1*z != b, a != b);
- BOOST_CHECK_EQUAL(r1*z <= b, a <= b);
- BOOST_CHECK_EQUAL(r1*z < b, a < b);
- BOOST_CHECK_EQUAL(r1*z >= b, a >= b);
- BOOST_CHECK_EQUAL(r1*z > b, a > b);
-
- BOOST_CHECK_EQUAL(a == r2*z, a == b);
- BOOST_CHECK_EQUAL(a != r2*z, a != b);
- BOOST_CHECK_EQUAL(a <= r2*z, a <= b);
- BOOST_CHECK_EQUAL(a < r2*z, a < b);
- BOOST_CHECK_EQUAL(a >= r2*z, a >= b);
- BOOST_CHECK_EQUAL(a > r2*z, a > b);
-
- BOOST_CHECK_EQUAL(normalize_compare_result(r1.compare(r2)), cr);
- BOOST_CHECK_EQUAL(normalize_compare_result(r2.compare(r1)), -cr);
- BOOST_CHECK_EQUAL(normalize_compare_result(r1.compare(b)), cr);
- BOOST_CHECK_EQUAL(normalize_compare_result(r2.compare(a)), -cr);
-}
-
-template <class Real, class Exp>
-void test_conditional(Real v, Exp e)
-{
- //
- // Verify that Exp is usable in Boolean contexts, and has the same value as v:
- //
- if(e)
- {
- BOOST_CHECK(v);
- }
- else
- {
- BOOST_CHECK(!v);
- }
- if(!e)
- {
- BOOST_CHECK(!v);
- }
- else
- {
- BOOST_CHECK(v);
- }
-}
-
-template <class Real>
-void test_complement(Real a, Real b, Real c, const boost::mpl::true_&)
-{
- int i = 1020304;
- int j = 56789123;
- int sign_mask = ~0;
- if(std::numeric_limits<Real>::is_signed)
- {
- BOOST_CHECK_EQUAL(~a , (~i & sign_mask));
- c = a & ~b;
- BOOST_CHECK_EQUAL(c , (i & (~j & sign_mask)));
- c = ~(a | b);
- BOOST_CHECK_EQUAL(c , (~(i | j) & sign_mask));
- }
- else
- {
- BOOST_CHECK_EQUAL((~a & a) , 0);
- }
-}
-
-template <class Real>
-void test_complement(Real, Real, Real, const boost::mpl::false_&)
-{
-}
-
-template <class Real, class T>
-void test_integer_ops(const T&){}
-
-template <class Real>
-void test_rational(const boost::mpl::true_&)
-{
- Real a(2);
- a /= 3;
- BOOST_CHECK_EQUAL(numerator(a) , 2);
- BOOST_CHECK_EQUAL(denominator(a) , 3);
- Real b(4);
- b /= 6;
- BOOST_CHECK_EQUAL(a , b);
-
- //
- // Check IO code:
- //
- std::stringstream ss;
- ss << a;
- ss >> b;
- BOOST_CHECK_EQUAL(a, b);
-}
-
-template <class Real>
-void test_rational(const boost::mpl::false_&)
-{
- Real a(2);
- a /= 3;
- BOOST_CHECK_EQUAL(numerator(a) , 2);
- BOOST_CHECK_EQUAL(denominator(a) , 3);
- Real b(4);
- b /= 6;
- BOOST_CHECK_EQUAL(a , b);
-
- BOOST_CHECK_THROW(Real(a / 0), std::overflow_error);
- BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
- b = Real("2/3");
- BOOST_CHECK_EQUAL(a, b);
- //
- // Check IO code:
- //
- std::stringstream ss;
- ss << a;
- ss >> b;
- BOOST_CHECK_EQUAL(a, b);
-}
-
-template <class Real>
-void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
-{
- test_rational<Real>(is_boost_rational<Real>());
-}
-
-template <class Real>
-void test_signed_integer_ops(const boost::mpl::true_&)
-{
- Real a(20);
- Real b(7);
- Real c(5);
- BOOST_CHECK_EQUAL(-a % c , 0);
- BOOST_CHECK_EQUAL(-a % b , -20 % 7);
- BOOST_CHECK_EQUAL(-a % -b , -20 % -7);
- BOOST_CHECK_EQUAL(a % -b , 20 % -7);
- BOOST_CHECK_EQUAL(-a % 7 , -20 % 7);
- BOOST_CHECK_EQUAL(-a % -7 , -20 % -7);
- BOOST_CHECK_EQUAL(a % -7 , 20 % -7);
- BOOST_CHECK_EQUAL(-a % 7u , -20 % 7);
- BOOST_CHECK_EQUAL(-a % a , 0);
- BOOST_CHECK_EQUAL(-a % 5 , 0);
- BOOST_CHECK_EQUAL(-a % -5 , 0);
- BOOST_CHECK_EQUAL(a % -5 , 0);
-
- b = -b;
- BOOST_CHECK_EQUAL(a % b , 20 % -7);
- a = -a;
- BOOST_CHECK_EQUAL(a % b , -20 % -7);
- BOOST_CHECK_EQUAL(a % -7 , -20 % -7);
- b = 7;
- BOOST_CHECK_EQUAL(a % b , -20 % 7);
- BOOST_CHECK_EQUAL(a % 7 , -20 % 7);
- BOOST_CHECK_EQUAL(a % 7u , -20 % 7);
-
- a = 20;
- a %= b;
- BOOST_CHECK_EQUAL(a , 20 % 7);
- a = -20;
- a %= b;
- BOOST_CHECK_EQUAL(a , -20 % 7);
- a = 20;
- a %= -b;
- BOOST_CHECK_EQUAL(a , 20 % -7);
- a = -20;
- a %= -b;
- BOOST_CHECK_EQUAL(a , -20 % -7);
- a = 5;
- a %= b - a;
- BOOST_CHECK_EQUAL(a , 5 % (7-5));
- a = -20;
- a %= 7;
- BOOST_CHECK_EQUAL(a , -20 % 7);
- a = 20;
- a %= -7;
- BOOST_CHECK_EQUAL(a , 20 % -7);
- a = -20;
- a %= -7;
- BOOST_CHECK_EQUAL(a , -20 % -7);
-#ifndef BOOST_NO_LONG_LONG
- a = -20;
- a %= 7uLL;
- BOOST_CHECK_EQUAL(a , -20 % 7);
- a = 20;
- a %= -7LL;
- BOOST_CHECK_EQUAL(a , 20 % -7);
- a = -20;
- a %= -7LL;
- BOOST_CHECK_EQUAL(a , -20 % -7);
-#endif
- a = 400;
- b = 45;
- BOOST_CHECK_EQUAL(gcd(a, -45) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(a, -45) , boost::math::lcm(400, 45));
- BOOST_CHECK_EQUAL(gcd(-400, b) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(-400, b) , boost::math::lcm(400, 45));
- a = -20;
- BOOST_CHECK_EQUAL(abs(a) , 20);
- BOOST_CHECK_EQUAL(abs(-a) , 20);
- BOOST_CHECK_EQUAL(abs(+a) , 20);
- a = 20;
- BOOST_CHECK_EQUAL(abs(a) , 20);
- BOOST_CHECK_EQUAL(abs(-a) , 20);
- BOOST_CHECK_EQUAL(abs(+a) , 20);
- a = -400;
- b = 45;
- BOOST_CHECK_EQUAL(gcd(a, b) , boost::math::gcd(-400, 45));
- BOOST_CHECK_EQUAL(lcm(a, b) , boost::math::lcm(-400, 45));
- BOOST_CHECK_EQUAL(gcd(a, 45) , boost::math::gcd(-400, 45));
- BOOST_CHECK_EQUAL(lcm(a, 45) , boost::math::lcm(-400, 45));
- BOOST_CHECK_EQUAL(gcd(-400, b) , boost::math::gcd(-400, 45));
- BOOST_CHECK_EQUAL(lcm(-400, b) , boost::math::lcm(-400, 45));
- Real r;
- divide_qr(a, b, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- BOOST_CHECK_EQUAL(integer_modulus(a, 57) , abs(a % 57));
- b = -57;
- divide_qr(a, b, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- BOOST_CHECK_EQUAL(integer_modulus(a, -57) , abs(a % -57));
- a = 458;
- divide_qr(a, b, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- BOOST_CHECK_EQUAL(integer_modulus(a, -57) , abs(a % -57));
-}
-template <class Real>
-void test_signed_integer_ops(const boost::mpl::false_&)
-{
-}
-
-template <class Real>
-void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
-{
- test_signed_integer_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
-
- Real a(20);
- Real b(7);
- Real c(5);
- BOOST_CHECK_EQUAL(a % b , 20 % 7);
- BOOST_CHECK_EQUAL(a % 7 , 20 % 7);
- BOOST_CHECK_EQUAL(a % 7u , 20 % 7);
- BOOST_CHECK_EQUAL(a % a , 0);
- BOOST_CHECK_EQUAL(a % c , 0);
- BOOST_CHECK_EQUAL(a % 5 , 0);
- a = a % (b + 0);
- BOOST_CHECK_EQUAL(a , 20 % 7);
- a = 20;
- c = (a + 2) % (a - 1);
- BOOST_CHECK_EQUAL(c , 22 % 19);
- c = 5;
- a = b % (a - 15);
- BOOST_CHECK_EQUAL(a , 7 % 5);
- a = 20;
-
- a = 20;
- a %= 7;
- BOOST_CHECK_EQUAL(a , 20 % 7);
-#ifndef BOOST_NO_LONG_LONG
- a = 20;
- a %= 7uLL;
- BOOST_CHECK_EQUAL(a , 20 % 7);
-#endif
- a = 20;
- BOOST_CHECK_EQUAL(++a , 21);
- BOOST_CHECK_EQUAL(--a , 20);
- BOOST_CHECK_EQUAL(a++ , 20);
- BOOST_CHECK_EQUAL(a , 21);
- BOOST_CHECK_EQUAL(a-- , 21);
- BOOST_CHECK_EQUAL(a , 20);
- a = 2000;
- a <<= 20;
- BOOST_CHECK_EQUAL(a , 2000L << 20);
- a >>= 20;
- BOOST_CHECK_EQUAL(a , 2000);
- a <<= 20u;
- BOOST_CHECK_EQUAL(a , 2000L << 20);
- a >>= 20u;
- BOOST_CHECK_EQUAL(a , 2000);
- BOOST_CHECK_THROW(a <<= -20, std::out_of_range);
- BOOST_CHECK_THROW(a >>= -20, std::out_of_range);
- BOOST_CHECK_THROW(Real(a << -20), std::out_of_range);
- BOOST_CHECK_THROW(Real(a >> -20), std::out_of_range);
-#ifndef BOOST_NO_LONG_LONG
- if(sizeof(long long) > sizeof(std::size_t))
- {
- // extreme values should trigger an exception:
- BOOST_CHECK_THROW(a >>= (1uLL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- BOOST_CHECK_THROW(a <<= (1uLL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- BOOST_CHECK_THROW(a >>= -(1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- BOOST_CHECK_THROW(a <<= -(1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- BOOST_CHECK_THROW(a >>= (1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- BOOST_CHECK_THROW(a <<= (1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
- // Unless they fit within range:
- a = 2000L;
- BOOST_CHECK_EQUAL((a <<= 20uLL) , (2000L << 20));
- a = 2000;
- BOOST_CHECK_EQUAL((a <<= 20LL) , (2000L << 20));
-
- BOOST_CHECK_THROW(Real(a >> (1uLL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- BOOST_CHECK_THROW(Real(a <<= (1uLL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- BOOST_CHECK_THROW(Real(a >>= -(1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- BOOST_CHECK_THROW(Real(a <<= -(1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- BOOST_CHECK_THROW(Real(a >>= (1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- BOOST_CHECK_THROW(Real(a <<= (1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
- // Unless they fit within range:
- a = 2000L;
- BOOST_CHECK_EQUAL(Real(a << 20uLL) , (2000L << 20));
- a = 2000;
- BOOST_CHECK_EQUAL(Real(a << 20LL) , (2000L << 20));
- }
-#endif
- a = 20;
- b = a << 20;
- BOOST_CHECK_EQUAL(b , (20 << 20));
- b = a >> 2;
- BOOST_CHECK_EQUAL(b , (20 >> 2));
- b = (a + 2) << 10;
- BOOST_CHECK_EQUAL(b , (22 << 10));
- b = (a + 3) >> 3;
- BOOST_CHECK_EQUAL(b , (23 >> 3));
- //
- // Bit fiddling:
- //
- int i = 1020304;
- int j = 56789123;
- int k = 4523187;
- a = i;
- b = j;
- c = a;
- c &= b;
- BOOST_CHECK_EQUAL(c , (i & j));
- c = a;
- c &= j;
- BOOST_CHECK_EQUAL(c , (i & j));
- c = a;
- c &= a + b;
- BOOST_CHECK_EQUAL(c , (i & (i + j)));
- BOOST_CHECK_EQUAL((a & b) , (i & j));
- c = k;
- a = a & (b + k);
- BOOST_CHECK_EQUAL(a , (i & (j + k)));
- a = i;
- a = (b + k) & a;
- BOOST_CHECK_EQUAL(a , (i & (j + k)));
- a = i;
- c = a & b & k;
- BOOST_CHECK_EQUAL(c , (i&j&k));
- c = a;
- c &= (c+b);
- BOOST_CHECK_EQUAL(c , (i & (i+j)));
- c = a & (b | 1);
- BOOST_CHECK_EQUAL(c , (i & (j | 1)));
-
- test_complement<Real>(a, b, c, typename is_twos_complement_integer<Real>::type());
-
- a = i;
- b = j;
- c = a;
- c |= b;
- BOOST_CHECK_EQUAL(c , (i | j));
- c = a;
- c |= j;
- BOOST_CHECK_EQUAL(c , (i | j));
- c = a;
- c |= a + b;
- BOOST_CHECK_EQUAL(c , (i | (i + j)));
- BOOST_CHECK_EQUAL((a | b) , (i | j));
- c = k;
- a = a | (b + k);
- BOOST_CHECK_EQUAL(a , (i | (j + k)));
- a = i;
- a = (b + k) | a;
- BOOST_CHECK_EQUAL(a , (i | (j + k)));
- a = i;
- c = a | b | k;
- BOOST_CHECK_EQUAL(c , (i|j|k));
- c = a;
- c |= (c + b);
- BOOST_CHECK_EQUAL(c , (i | (i+j)));
- c = a | (b | 1);
- BOOST_CHECK_EQUAL(c , (i | (j | 1)));
-
- a = i;
- b = j;
- c = a;
- c ^= b;
- BOOST_CHECK_EQUAL(c , (i ^ j));
- c = a;
- c ^= j;
- BOOST_CHECK_EQUAL(c , (i ^ j));
- c = a;
- c ^= a + b;
- BOOST_CHECK_EQUAL(c , (i ^ (i + j)));
- BOOST_CHECK_EQUAL((a ^ b) , (i ^ j));
- c = k;
- a = a ^ (b + k);
- BOOST_CHECK_EQUAL(a , (i ^ (j + k)));
- a = i;
- a = (b + k) ^ a;
- BOOST_CHECK_EQUAL(a , (i ^ (j + k)));
- a = i;
- c = a ^ b ^ k;
- BOOST_CHECK_EQUAL(c , (i^j^k));
- c = a;
- c ^= (c + b);
- BOOST_CHECK_EQUAL(c , (i ^ (i+j)));
- c = a ^ (b | 1);
- BOOST_CHECK_EQUAL(c , (i ^ (j | 1)));
-
- a = i;
- b = j;
- c = k;
- //
- // Non-member functions:
- //
- a = 400;
- b = 45;
- BOOST_CHECK_EQUAL(gcd(a, b) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(a, b) , boost::math::lcm(400, 45));
- BOOST_CHECK_EQUAL(gcd(a, 45) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(a, 45) , boost::math::lcm(400, 45));
- BOOST_CHECK_EQUAL(gcd(a, 45u) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(a, 45u) , boost::math::lcm(400, 45));
- BOOST_CHECK_EQUAL(gcd(400, b) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(400, b) , boost::math::lcm(400, 45));
- BOOST_CHECK_EQUAL(gcd(400u, b) , boost::math::gcd(400, 45));
- BOOST_CHECK_EQUAL(lcm(400u, b) , boost::math::lcm(400, 45));
-
- //
- // Conditionals involving 2 arg functions:
- //
- test_conditional(Real(gcd(a, b)), gcd(a, b));
-
- Real r;
- divide_qr(a, b, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- divide_qr(a + 0, b, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- divide_qr(a, b+0, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- divide_qr(a+0, b+0, c, r);
- BOOST_CHECK_EQUAL(c , a / b);
- BOOST_CHECK_EQUAL(r , a % b);
- BOOST_CHECK_EQUAL(integer_modulus(a, 57) , a % 57);
- for(unsigned i = 0; i < 20; ++i)
- {
- if(std::numeric_limits<Real>::is_specialized && (!std::numeric_limits<Real>::is_bounded || ((int)i * 17 < std::numeric_limits<Real>::digits)))
- {
- BOOST_CHECK_EQUAL(lsb(Real(1) << (i * 17)) , i * 17);
- BOOST_CHECK(bit_test(Real(1) << (i * 17), i * 17));
- BOOST_CHECK(!bit_test(Real(1) << (i * 17), i * 17 + 1));
- if(i)
- {
- BOOST_CHECK(!bit_test(Real(1) << (i * 17), i * 17 - 1));
- }
- Real zero(0);
- BOOST_CHECK(bit_test(bit_set(zero, i * 17), i * 17));
- zero = 0;
- BOOST_CHECK_EQUAL(bit_flip(zero, i*17) , Real(1) << i * 17);
- zero = Real(1) << i * 17;
- BOOST_CHECK_EQUAL(bit_flip(zero, i * 17) , 0);
- zero = Real(1) << i * 17;
- BOOST_CHECK_EQUAL(bit_unset(zero, i * 17) , 0);
- }
- }
- //
- // pow, powm:
- //
- BOOST_CHECK_EQUAL(pow(Real(3), 4) , 81);
- BOOST_CHECK_EQUAL(pow(Real(3) + Real(0), 4) , 81);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4), Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4), 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4), Real(13) + 0) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, Real(13) + 0) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, Real(13) + 0) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), Real(13) + 0) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, Real(13) + 0) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, Real(13)) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, 13) , 81 % 13);
- BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, Real(13) + 0) , 81 % 13);
- //
- // Conditionals involving 3 arg functions:
- //
- test_conditional(Real(powm(Real(3), Real(4), Real(13))), powm(Real(3), Real(4), Real(13)));
-
- //
- // Things that are expected errors:
- //
- BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
- BOOST_CHECK_THROW(Real("3L"), std::runtime_error);
- BOOST_CHECK_THROW(Real(Real(20) / 0u), std::overflow_error);
- //
- // Extra tests added for full coverage:
- //
- a = 20;
- b = 7;
- c = 20 % b;
- BOOST_CHECK_EQUAL(c , (20 % 7));
- c = 20 % (b + 0);
- BOOST_CHECK_EQUAL(c , (20 % 7));
- c = a & 10;
- BOOST_CHECK_EQUAL(c , (20 & 10));
- c = 10 & a;
- BOOST_CHECK_EQUAL(c , (20 & 10));
- c = (a + 0) & (b + 0);
- BOOST_CHECK_EQUAL(c , (20 & 7));
- c = 10 & (a + 0);
- BOOST_CHECK_EQUAL(c , (20 & 10));
- c = 10 | a;
- BOOST_CHECK_EQUAL(c , (20 | 10));
- c = (a + 0) | (b + 0);
- BOOST_CHECK(c == (20 | 7))
- c = 20 | (b + 0);
- BOOST_CHECK_EQUAL(c , (20 | 7));
- c = a ^ 7;
- BOOST_CHECK_EQUAL(c , (20 ^ 7));
- c = 20 ^ b;
- BOOST_CHECK_EQUAL(c , (20 ^ 7));
- c = (a + 0) ^ (b + 0);
- BOOST_CHECK_EQUAL(c , (20 ^ 7));
- c = 20 ^ (b + 0);
- BOOST_CHECK_EQUAL(c , (20 ^ 7));
-}
-
-template <class Real, class T>
-void test_float_ops(const T&){}
-
-template <class Real>
-void test_float_ops(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
-{
- BOOST_CHECK_EQUAL(abs(Real(2)) , 2);
- BOOST_CHECK_EQUAL(abs(Real(-2)) , 2);
- BOOST_CHECK_EQUAL(fabs(Real(2)) , 2);
- BOOST_CHECK_EQUAL(fabs(Real(-2)) , 2);
- BOOST_CHECK_EQUAL(floor(Real(5) / 2) , 2);
- BOOST_CHECK_EQUAL(ceil(Real(5) / 2) , 3);
- BOOST_CHECK_EQUAL(floor(Real(-5) / 2) , -3);
- BOOST_CHECK_EQUAL(ceil(Real(-5) / 2) , -2);
- BOOST_CHECK_EQUAL(trunc(Real(5) / 2) , 2);
- BOOST_CHECK_EQUAL(trunc(Real(-5) / 2) , -2);
- //
- // ldexp and frexp, these pretty much have to be implemented by each backend:
- //
- BOOST_CHECK_EQUAL(ldexp(Real(2), 5) , 64);
- BOOST_CHECK_EQUAL(ldexp(Real(2), -5) , Real(2) / 32);
- Real v(512);
- int exp;
- Real r = frexp(v, &exp);
- BOOST_CHECK_EQUAL(r , 0.5);
- BOOST_CHECK_EQUAL(exp , 10);
- BOOST_CHECK_EQUAL(v , 512);
- v = 1 / v;
- r = frexp(v, &exp);
- BOOST_CHECK_EQUAL(r , 0.5);
- BOOST_CHECK_EQUAL(exp , -8);
- typedef typename Real::backend_type::exponent_type e_type;
- BOOST_CHECK_EQUAL(ldexp(Real(2), e_type(5)) , 64);
- BOOST_CHECK_EQUAL(ldexp(Real(2), e_type(-5)) , Real(2) / 32);
- v = 512;
- e_type exp2;
- r = frexp(v, &exp2);
- BOOST_CHECK_EQUAL(r , 0.5);
- BOOST_CHECK_EQUAL(exp2 , 10);
- BOOST_CHECK_EQUAL(v , 512);
- v = 1 / v;
- r = frexp(v, &exp2);
- BOOST_CHECK_EQUAL(r , 0.5);
- BOOST_CHECK_EQUAL(exp2 , -8);
- //
- // pow and exp:
- //
- v = 3.25;
- r = pow(v, 0);
- BOOST_CHECK_EQUAL(r , 1);
- r = pow(v, 1);
- BOOST_CHECK_EQUAL(r , 3.25);
- r = pow(v, 2);
- BOOST_CHECK_EQUAL(r , boost::math::pow<2>(3.25));
- r = pow(v, 3);
- BOOST_CHECK_EQUAL(r , boost::math::pow<3>(3.25));
- r = pow(v, 4);
- BOOST_CHECK_EQUAL(r , boost::math::pow<4>(3.25));
- r = pow(v, 5);
- BOOST_CHECK_EQUAL(r , boost::math::pow<5>(3.25));
- r = pow(v, 6);
- BOOST_CHECK_EQUAL(r , boost::math::pow<6>(3.25));
- r = pow(v, 25);
- BOOST_CHECK_EQUAL(r , boost::math::pow<25>(Real(3.25)));
- //
- // Things that are expected errors:
- //
- BOOST_CHECK_THROW(Real("3.14L"), std::runtime_error);
- if(std::numeric_limits<Real>::is_specialized)
- {
- if(std::numeric_limits<Real>::has_infinity)
- {
- BOOST_CHECK(boost::math::isinf(Real(20) / 0u));
- }
- else
- {
- BOOST_CHECK_THROW(Real(Real(20) / 0u), std::overflow_error);
- }
- }
-}
-
-template <class T>
-struct lexical_cast_target_type
-{
- typedef typename boost::mpl::if_<
- boost::is_signed<T>,
- boost::intmax_t,
- typename boost::mpl::if_<
- boost::is_unsigned<T>,
- boost::uintmax_t,
- T
- >::type
- >::type type;
-};
-
-template <class Real, class Num>
-void test_negative_mixed(boost::mpl::true_ const&)
-{
- typedef typename lexical_cast_target_type<Num>::type target_type;
- typedef typename boost::mpl::if_<
- boost::is_convertible<Num, Real>,
- typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
- Real
- >::type cast_type;
- typedef typename boost::mpl::if_<
- boost::is_convertible<Num, Real>,
- Num,
- Real
- >::type simple_cast_type;
- std::cout << "Testing mixed arithmetic with type: " << typeid(Real).name() << " and " << typeid(Num).name() << std::endl;
- static const int left_shift = std::numeric_limits<Num>::digits - 1;
- Num n1 = -static_cast<Num>(1uLL << ((left_shift < 63) && (left_shift > 0) ? left_shift : 10));
- Num n2 = -1;
- Num n3 = 0;
- Num n4 = -20;
- Num n5 = -8;
-
- test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
-
- // Default construct:
- BOOST_CHECK_EQUAL(Real(n1) , static_cast<cast_type>(n1));
- BOOST_CHECK_EQUAL(Real(n2) , static_cast<cast_type>(n2));
- BOOST_CHECK_EQUAL(Real(n3) , static_cast<cast_type>(n3));
- BOOST_CHECK_EQUAL(Real(n4) , static_cast<cast_type>(n4));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n1) , Real(n1));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n2) , Real(n2));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n3) , Real(n3));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n4) , Real(n4));
- BOOST_CHECK_EQUAL(Real(n1).template convert_to<Num>() , n1);
- BOOST_CHECK_EQUAL(Real(n2).template convert_to<Num>() , n2);
- BOOST_CHECK_EQUAL(Real(n3).template convert_to<Num>() , n3);
- BOOST_CHECK_EQUAL(Real(n4).template convert_to<Num>() , n4);
-#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n1)) , n1);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n2)) , n2);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n3)) , n3);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n4)) , n4);
-#endif
-#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
- Num tol = 10 * std::numeric_limits<Num>::epsilon();
-#else
- Num tol = 0;
-#endif
- std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
- if(std::numeric_limits<target_type>::digits <= std::numeric_limits<Real>::digits)
- {
- BOOST_CHECK_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
- }
- BOOST_CHECK_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
- BOOST_CHECK_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
- BOOST_CHECK_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
- // Assignment:
- Real r(0);
- BOOST_CHECK(r != static_cast<cast_type>(n1));
- r = static_cast<simple_cast_type>(n1);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1));
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2));
- r = static_cast<simple_cast_type>(n3);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n3));
- r = static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
- // Addition:
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r + static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 + n4));
- BOOST_CHECK_EQUAL(Real(r + static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 + n4));
- r += static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 + n4));
- // subtraction:
- r = static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r - static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n4 - n5));
- BOOST_CHECK_EQUAL(Real(r - static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n4 - n5));
- r -= static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
- // Multiplication:
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r * static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 * n4));
- BOOST_CHECK_EQUAL(Real(r * static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 * n4));
- r *= static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 * n4));
- // Division:
- r = static_cast<simple_cast_type>(n1);
- BOOST_CHECK_EQUAL(r / static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n1 / n5));
- BOOST_CHECK_EQUAL(Real(r / static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n1 / n5));
- r /= static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1 / n5));
- //
- // Extra cases for full coverage:
- //
- r = Real(n4) + static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
- r = static_cast<simple_cast_type>(n4) + Real(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
- r = Real(n4) - static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
- r = static_cast<simple_cast_type>(n4) - Real(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
- r = static_cast<simple_cast_type>(n4) * Real(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 * n5));
- r = static_cast<cast_type>(4 * n4) / Real(4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
-
- Real a, b, c;
- a = 20;
- b = 30;
- c = -a + b;
- BOOST_CHECK_EQUAL(c , 10);
- c = b + -a;
- BOOST_CHECK_EQUAL(c , 10);
- n4 = 30;
- c = -a + static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , 10);
- c = static_cast<cast_type>(n4) + -a;
- BOOST_CHECK_EQUAL(c , 10);
- c = -a + -b;
- BOOST_CHECK_EQUAL(c , -50);
- n4 = 4;
- c = -(a + b) + static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , -50+4);
- n4 = 50;
- c = (a + b) - static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , 0);
- c = (a + b) - static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , 0);
- c = a - -(b + static_cast<cast_type>(n4));
- BOOST_CHECK_EQUAL(c , 20 - -(30 + 50));
- c = -(b + static_cast<cast_type>(n4)) - a;
- BOOST_CHECK_EQUAL(c , -(30 + 50) - 20);
- c = a - -b;
- BOOST_CHECK_EQUAL(c , 50);
- c = -a - b;
- BOOST_CHECK_EQUAL(c , -50);
- c = -a - static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , -20 - 50);
- c = static_cast<cast_type>(n4) - -a;
- BOOST_CHECK_EQUAL(c , 50 + 20);
- c = -(a + b) - Real(n4);
- BOOST_CHECK_EQUAL(c , -(20 + 30) - 50);
- c = static_cast<cast_type>(n4) - (a + b);
- BOOST_CHECK_EQUAL(c , 0);
- c = (a + b) * static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , 50 * 50);
- c = static_cast<cast_type>(n4) * (a + b);
- BOOST_CHECK_EQUAL(c , 50 * 50);
- c = a * -(b + static_cast<cast_type>(n4));
- BOOST_CHECK_EQUAL(c , 20 * -(30 + 50));
- c = -(b + static_cast<cast_type>(n4)) * a;
- BOOST_CHECK_EQUAL(c , 20 * -(30 + 50));
- c = a * -b;
- BOOST_CHECK_EQUAL(c , 20 * -30);
- c = -a * b;
- BOOST_CHECK_EQUAL(c , 20 * -30);
- c = -a * static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , -20 * 50);
- c = static_cast<cast_type>(n4) * -a;
- BOOST_CHECK_EQUAL(c , -20 * 50);
- c = -(a + b) + a;
- BOOST_CHECK(-50 + 20);
- c = static_cast<cast_type>(n4) - (a + b);
- BOOST_CHECK_EQUAL(c , 0);
- Real d = 10;
- c = (a + b) / d;
- BOOST_CHECK_EQUAL(c , 5);
- c = (a + b) / (d + 0);
- BOOST_CHECK_EQUAL(c , 5);
- c = (a + b) / static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , 1);
- c = static_cast<cast_type>(n4) / (a + b);
- BOOST_CHECK_EQUAL(c , 1);
- d = 50;
- c = d / -(a + b);
- BOOST_CHECK_EQUAL(c , -1);
- c = -(a + b) / d;
- BOOST_CHECK_EQUAL(c , -1);
- d = 2;
- c = a / -d;
- BOOST_CHECK_EQUAL(c , 20 / -2);
- c = -a / d;
- BOOST_CHECK_EQUAL(c , 20 / -2);
- d = 50;
- c = -d / static_cast<cast_type>(n4);
- BOOST_CHECK_EQUAL(c , -1);
- c = static_cast<cast_type>(n4) / -d;
- BOOST_CHECK_EQUAL(c , -1);
- c = static_cast<cast_type>(n4) + a;
- BOOST_CHECK_EQUAL(c , 70);
- c = static_cast<cast_type>(n4) - a;
- BOOST_CHECK_EQUAL(c , 30);
- c = static_cast<cast_type>(n4) * a;
- BOOST_CHECK_EQUAL(c , 50 * 20);
-
- n1 = -2;
- n2 = -3;
- n3 = -4;
- a = static_cast<cast_type>(n1);
- b = static_cast<cast_type>(n2);
- c = static_cast<cast_type>(n3);
- d = a + b * c;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = static_cast<cast_type>(n1) + b * c;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = a + static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = a + b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- a += static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(a , -2 + -3 * -4);
- a = static_cast<cast_type>(n1);
- a += b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(a , -2 + -3 * -4);
- a = static_cast<cast_type>(n1);
-
- d = b * c + a;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = b * c + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = static_cast<cast_type>(n2) * c + a;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = b * static_cast<cast_type>(n3) + a;
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
- d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
-
- a = -20;
- d = a - b * c;
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- n1 = -20;
- d = static_cast<cast_type>(n1) - b * c;
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- d = a - static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- d = a - b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
- a -= static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(a , -20 - -3 * -4);
- a = static_cast<cast_type>(n1);
- a -= b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(a , -20 - -3 * -4);
-
- a = -2;
- d = b * c - a;
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
- n1 = -2;
- d = b * c - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
- d = static_cast<cast_type>(n2) * c - a;
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
- d = b * static_cast<cast_type>(n3) - a;
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
- d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
- d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
-}
-
-template <class Real, class Num>
-void test_negative_mixed(boost::mpl::false_ const&)
-{
-}
-
-template <class Real, class Num>
-void test_mixed(const boost::mpl::false_&)
-{
-}
-
-template <class Real, class Num>
-void test_mixed(const boost::mpl::true_&)
-{
- typedef typename lexical_cast_target_type<Num>::type target_type;
- typedef typename boost::mpl::if_<
- boost::is_convertible<Num, Real>,
- typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
- Real
- >::type cast_type;
- typedef typename boost::mpl::if_<
- boost::is_convertible<Num, Real>,
- Num,
- Real
- >::type simple_cast_type;
-
- if(std::numeric_limits<Real>::is_specialized && std::numeric_limits<Real>::is_bounded && std::numeric_limits<Real>::digits < std::numeric_limits<Num>::digits)
- return;
-
- std::cout << "Testing mixed arithmetic with type: " << typeid(Real).name() << " and " << typeid(Num).name() << std::endl;
- static const int left_shift = std::numeric_limits<Num>::digits - 1;
- Num n1 = static_cast<Num>(1uLL << ((left_shift < 63) && (left_shift > 0) ? left_shift : 10));
- Num n2 = 1;
- Num n3 = 0;
- Num n4 = 20;
- Num n5 = 8;
-
- test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
- test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
-
- // Default construct:
- BOOST_CHECK_EQUAL(Real(n1) , static_cast<cast_type>(n1));
- BOOST_CHECK_EQUAL(Real(n2) , static_cast<cast_type>(n2));
- BOOST_CHECK_EQUAL(Real(n3) , static_cast<cast_type>(n3));
- BOOST_CHECK_EQUAL(Real(n4) , static_cast<cast_type>(n4));
- BOOST_CHECK_EQUAL(Real(n1).template convert_to<Num>() , n1);
- BOOST_CHECK_EQUAL(Real(n2).template convert_to<Num>() , n2);
- BOOST_CHECK_EQUAL(Real(n3).template convert_to<Num>() , n3);
- BOOST_CHECK_EQUAL(Real(n4).template convert_to<Num>() , n4);
-#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n1)) , n1);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n2)) , n2);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n3)) , n3);
- BOOST_CHECK_EQUAL(static_cast<Num>(Real(n4)) , n4);
-#endif
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n1) , Real(n1));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n2) , Real(n2));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n3) , Real(n3));
- BOOST_CHECK_EQUAL(static_cast<cast_type>(n4) , Real(n4));
-#if defined(TEST_MPFR) || defined(TEST_MPFR_50)
- Num tol = 10 * std::numeric_limits<Num>::epsilon();
-#else
- Num tol = 0;
-#endif
- std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
- if(std::numeric_limits<target_type>::digits <= std::numeric_limits<Real>::digits)
- {
- BOOST_CHECK_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
- }
- BOOST_CHECK_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
- BOOST_CHECK_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
- BOOST_CHECK_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
- // Assignment:
- Real r(0);
- BOOST_CHECK(r != static_cast<cast_type>(n1));
- r = static_cast<simple_cast_type>(n1);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1));
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2));
- r = static_cast<simple_cast_type>(n3);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n3));
- r = static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
- // Addition:
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r + static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 + n4));
- BOOST_CHECK_EQUAL(Real(r + static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 + n4));
- r += static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 + n4));
- // subtraction:
- r = static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r - static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n4 - n5));
- BOOST_CHECK_EQUAL(Real(r - static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n4 - n5));
- r -= static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
- // Multiplication:
- r = static_cast<simple_cast_type>(n2);
- BOOST_CHECK_EQUAL(r * static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 * n4));
- BOOST_CHECK_EQUAL(Real(r * static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 * n4));
- r *= static_cast<simple_cast_type>(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 * n4));
- // Division:
- r = static_cast<simple_cast_type>(n1);
- BOOST_CHECK_EQUAL(r / static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n1 / n5));
- BOOST_CHECK_EQUAL(Real(r / static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n1 / n5));
- r /= static_cast<simple_cast_type>(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1 / n5));
- //
- // special cases for full coverage:
- //
- r = static_cast<simple_cast_type>(n5) + Real(n4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
- r = static_cast<simple_cast_type>(n4) - Real(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
- r = static_cast<simple_cast_type>(n4) * Real(n5);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 * n5));
- r = static_cast<cast_type>(4 * n4) / Real(4);
- BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
-
- typedef boost::mpl::bool_<
- (!std::numeric_limits<Num>::is_specialized || std::numeric_limits<Num>::is_signed)
- && (!std::numeric_limits<Real>::is_specialized || std::numeric_limits<Real>::is_signed)> signed_tag;
-
- test_negative_mixed<Real, Num>(signed_tag());
-
- n1 = 2;
- n2 = 3;
- n3 = 4;
- Real a(n1), b(n2), c(n3), d;
- d = a + b * c;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = static_cast<cast_type>(n1) + b * c;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = a + static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = a + b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- a += static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(a , 2 + 3 * 4);
- a = static_cast<cast_type>(n1);
- a += b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(a , 2 + 3 * 4);
- a = static_cast<cast_type>(n1);
-
- d = b * c + a;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = b * c + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = static_cast<cast_type>(n2) * c + a;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = b * static_cast<cast_type>(n3) + a;
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
- d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
-
- a = 20;
- d = a - b * c;
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- n1 = 20;
- d = static_cast<cast_type>(n1) - b * c;
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- d = a - static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- d = a - b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
- a -= static_cast<cast_type>(n2) * c;
- BOOST_CHECK_EQUAL(a , 20 - 3 * 4);
- a = static_cast<cast_type>(n1);
- a -= b * static_cast<cast_type>(n3);
- BOOST_CHECK_EQUAL(a , 20 - 3 * 4);
-
- a = 2;
- d = b * c - a;
- BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
- n1 = 2;
- d = b * c - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
- d = static_cast<cast_type>(n2) * c - a;
- BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
- d = b * static_cast<cast_type>(n3) - a;
- BOOST_CHECK_EQUAL(d , 3 * 4 - a);
- d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
- d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
- BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
-}
-
-template <class Real>
-void test_members(Real)
-{
- //
- // Test sign and zero functions:
- //
- Real a = 20;
- Real b = 30;
- BOOST_CHECK(a.sign() > 0);
- BOOST_CHECK(!a.is_zero());
- if(std::numeric_limits<Real>::is_signed)
- {
- a = -20;
- BOOST_CHECK(a.sign() < 0);
- BOOST_CHECK(!a.is_zero());
- }
- a = 0;
- BOOST_CHECK_EQUAL(a.sign() , 0);
- BOOST_CHECK(a.is_zero());
-
- a = 20;
- b = 30;
- a.swap(b);
- BOOST_CHECK_EQUAL(a , 30);
- BOOST_CHECK_EQUAL(b , 20);
-}
-
-template <class Real>
-void test_members(boost::rational<Real>)
-{
-}
-
-template <class Real>
-void test_signed_ops(const boost::mpl::true_&)
-{
- Real a(8);
- Real b(64);
- Real c(500);
- Real d(1024);
- Real ac;
- BOOST_CHECK_EQUAL(-a , -8);
- ac = a;
- ac = ac - b;
- BOOST_CHECK_EQUAL(ac , 8 - 64);
- ac = a;
- ac -= a + b;
- BOOST_CHECK_EQUAL(ac , -64);
- ac = a;
- ac -= b - a;
- BOOST_CHECK_EQUAL(ac , 16 - 64);
- ac = -a;
- BOOST_CHECK_EQUAL(ac , -8);
- ac = a;
- ac -= -a;
- BOOST_CHECK_EQUAL(ac , 16);
- ac = a;
- ac += -a;
- BOOST_CHECK_EQUAL(ac , 0);
- ac = b;
- ac /= -a;
- BOOST_CHECK_EQUAL(ac , -8);
- ac = a;
- ac *= -a;
- BOOST_CHECK_EQUAL(ac , -64);
- ac = a + -b;
- BOOST_CHECK_EQUAL(ac , 8 - 64);
- ac = -a + b;
- BOOST_CHECK_EQUAL(ac , -8+64);
- ac = -a + -b;
- BOOST_CHECK_EQUAL(ac , -72);
- ac = a + - + -b; // lots of unary operators!!
- BOOST_CHECK_EQUAL(ac , 72);
- test_conditional(Real(-a), -a);
-}
-template <class Real>
-void test_signed_ops(const boost::mpl::false_&)
-{
-}
-
-template <class Real>
-void test()
-{
-#ifndef NO_MIXED_OPS
- boost::multiprecision::is_number<Real> tag;
- test_mixed<Real, unsigned char>(tag);
- test_mixed<Real, signed char>(tag);
- test_mixed<Real, char>(tag);
- test_mixed<Real, short>(tag);
- test_mixed<Real, unsigned short>(tag);
- test_mixed<Real, int>(tag);
- test_mixed<Real, unsigned int>(tag);
- test_mixed<Real, long>(tag);
- test_mixed<Real, unsigned long>(tag);
-#ifdef BOOST_HAS_LONG_LONG
- test_mixed<Real, long long>(tag);
- test_mixed<Real, unsigned long long>(tag);
-#endif
- test_mixed<Real, float>(tag);
- test_mixed<Real, double>(tag);
- test_mixed<Real, long double>(tag);
-
- typedef typename related_type<Real>::type related_type;
- boost::mpl::bool_<boost::multiprecision::is_number<Real>::value && !boost::is_same<related_type, Real>::value> tag2;
-
- test_mixed<Real, related_type>(tag2);
-
-#endif
- //
- // Integer only functions:
- //
- test_integer_ops<Real>(typename boost::multiprecision::number_category<Real>::type());
- //
- // Real number only functions:
- //
- test_float_ops<Real>(typename boost::multiprecision::number_category<Real>::type());
- //
- // Test basic arithmetic:
- //
- Real a(8);
- Real b(64);
- Real c(500);
- Real d(1024);
- BOOST_CHECK_EQUAL(a + b , 72);
- a += b;
- BOOST_CHECK_EQUAL(a , 72);
- BOOST_CHECK_EQUAL(a - b , 8);
- a -= b;
- BOOST_CHECK_EQUAL(a , 8);
- BOOST_CHECK_EQUAL(a * b , 8*64L);
- a *= b;
- BOOST_CHECK_EQUAL(a , 8*64L);
- BOOST_CHECK_EQUAL(a / b , 8);
- a /= b;
- BOOST_CHECK_EQUAL(a , 8);
- Real ac(a);
- BOOST_CHECK_EQUAL(ac , a);
- ac = a * c;
- BOOST_CHECK_EQUAL(ac , 8*500L);
- ac = 8*500L;
- ac = ac + b + c;
- BOOST_CHECK_EQUAL(ac , 8*500L+64+500);
- ac = a;
- ac = b + c + ac;
- BOOST_CHECK_EQUAL(ac , 8+64+500);
- ac = ac - b + c;
- BOOST_CHECK_EQUAL(ac , 8+64+500-64+500);
- ac = a;
- ac = b + c - ac;
- BOOST_CHECK_EQUAL(ac , -8+64+500);
- ac = a;
- ac = ac * b;
- BOOST_CHECK_EQUAL(ac , 8*64);
- ac = a;
- ac *= b * ac;
- BOOST_CHECK_EQUAL(ac , 8*8*64);
- ac = b;
- ac = ac / a;
- BOOST_CHECK_EQUAL(ac , 64/8);
- ac = b;
- ac /= ac / a;
- BOOST_CHECK_EQUAL(ac , 64 / (64/8));
- ac = a;
- ac = b + ac * a;
- BOOST_CHECK_EQUAL(ac , 64 * 2);
- ac = a;
- ac = b - ac * a;
- BOOST_CHECK_EQUAL(ac , 0);
- ac = a;
- ac = b * (ac + a);
- BOOST_CHECK_EQUAL(ac , 64 * (16));
- ac = a;
- ac = b / (ac * 1);
- BOOST_CHECK_EQUAL(ac , 64 / 8);
- ac = a;
- ac = ac + b;
- BOOST_CHECK_EQUAL(ac , 8 + 64);
- ac = a;
- ac = a + ac;
- BOOST_CHECK_EQUAL(ac , 16);
- ac = a;
- ac = a - ac;
- BOOST_CHECK_EQUAL(ac , 0);
- ac = a;
- ac += a + b;
- BOOST_CHECK_EQUAL(ac , 80);
- ac = a;
- ac += b + a;
- BOOST_CHECK_EQUAL(ac , 80);
- ac = +a;
- BOOST_CHECK_EQUAL(ac , 8);
- ac = 8;
- ac = a * ac;
- BOOST_CHECK_EQUAL(ac , 8*8);
- ac = a;
- ac = a;
- ac += +a;
- BOOST_CHECK_EQUAL(ac , 16);
- ac = a;
- ac += b - a;
- BOOST_CHECK_EQUAL(ac , 8 + 64-8);
- ac = a;
- ac += b*c;
- BOOST_CHECK_EQUAL(ac , 8 + 64 * 500);
- ac = a;
- ac = a;
- ac -= +a;
- BOOST_CHECK_EQUAL(ac , 0);
- ac = a;
- if(std::numeric_limits<Real>::is_signed || is_twos_complement_integer<Real>::value)
- {
- ac = a;
- ac -= c - b;
- BOOST_CHECK_EQUAL(ac , 8 - (500-64));
- ac = a;
- ac -= b*c;
- BOOST_CHECK_EQUAL(ac , 8 - 500*64);
- }
- ac = a;
- ac += ac * b;
- BOOST_CHECK_EQUAL(ac , 8 + 8 * 64);
- if(std::numeric_limits<Real>::is_signed || is_twos_complement_integer<Real>::value)
- {
- ac = a;
- ac -= ac * b;
- BOOST_CHECK_EQUAL(ac , 8 - 8 * 64);
- }
- ac = a * 8;
- ac *= +a;
- BOOST_CHECK_EQUAL(ac , 64 * 8);
- ac = a;
- ac *= b * c;
- BOOST_CHECK_EQUAL(ac , 8 * 64 * 500);
- ac = a;
- ac *= b / a;
- BOOST_CHECK_EQUAL(ac , 8 * 64 / 8);
- ac = a;
- ac *= b + c;
- BOOST_CHECK_EQUAL(ac , 8 * (64 + 500));
- ac = b;
- ac /= +a;
- BOOST_CHECK_EQUAL(ac , 8);
- ac = b;
- ac /= b / a;
- BOOST_CHECK_EQUAL(ac , 64 / (64/8));
- ac = b;
- ac /= a + Real(0);
- BOOST_CHECK_EQUAL(ac , 8);
- //
- // simple tests with immediate values, these calls can be optimised in many backends:
- //
- ac = a + b;
- BOOST_CHECK_EQUAL(ac , 72);
- ac = a + +b;
- BOOST_CHECK_EQUAL(ac , 72);
- ac = +a + b;
- BOOST_CHECK_EQUAL(ac , 72);
- ac = +a + +b;
- BOOST_CHECK_EQUAL(ac , 72);
- ac = a;
- ac = b / ac;
- BOOST_CHECK_EQUAL(ac , b / a);
- //
- // Comparisons:
- //
- BOOST_CHECK_EQUAL((a == b) , false);
- BOOST_CHECK_EQUAL((a != b) , true);
- BOOST_CHECK_EQUAL((a <= b) , true);
- BOOST_CHECK_EQUAL((a < b) , true);
- BOOST_CHECK_EQUAL((a >= b) , false);
- BOOST_CHECK_EQUAL((a > b) , false);
-
- BOOST_CHECK_EQUAL((a+b == b) , false);
- BOOST_CHECK_EQUAL((a+b != b) , true);
- BOOST_CHECK_EQUAL((a+b >= b) , true);
- BOOST_CHECK_EQUAL((a+b > b) , true);
- BOOST_CHECK_EQUAL((a+b <= b) , false);
- BOOST_CHECK_EQUAL((a+b < b) , false);
-
- BOOST_CHECK_EQUAL((a == b+a) , false);
- BOOST_CHECK_EQUAL((a != b+a) , true);
- BOOST_CHECK_EQUAL((a <= b+a) , true);
- BOOST_CHECK_EQUAL((a < b+a) , true);
- BOOST_CHECK_EQUAL((a >= b+a) , false);
- BOOST_CHECK_EQUAL((a > b+a) , false);
-
- BOOST_CHECK_EQUAL((a+b == b+a) , true);
- BOOST_CHECK_EQUAL((a+b != b+a) , false);
- BOOST_CHECK_EQUAL((a+b <= b+a) , true);
- BOOST_CHECK_EQUAL((a+b < b+a) , false);
- BOOST_CHECK_EQUAL((a+b >= b+a) , true);
- BOOST_CHECK_EQUAL((a+b > b+a) , false);
-
- BOOST_CHECK_EQUAL((8 == b+a) , false);
- BOOST_CHECK_EQUAL((8 != b+a) , true);
- BOOST_CHECK_EQUAL((8 <= b+a) , true);
- BOOST_CHECK_EQUAL((8 < b+a) , true);
- BOOST_CHECK_EQUAL((8 >= b+a) , false);
- BOOST_CHECK_EQUAL((8 > b+a) , false);
- BOOST_CHECK_EQUAL((800 == b+a) , false);
- BOOST_CHECK_EQUAL((800 != b+a) , true);
- BOOST_CHECK_EQUAL((800 >= b+a) , true);
- BOOST_CHECK_EQUAL((800 > b+a) , true);
- BOOST_CHECK_EQUAL((800 <= b+a) , false);
- BOOST_CHECK_EQUAL((800 < b+a) , false);
- BOOST_CHECK_EQUAL((72 == b+a) , true);
- BOOST_CHECK_EQUAL((72 != b+a) , false);
- BOOST_CHECK_EQUAL((72 <= b+a) , true);
- BOOST_CHECK_EQUAL((72 < b+a) , false);
- BOOST_CHECK_EQUAL((72 >= b+a) , true);
- BOOST_CHECK_EQUAL((72 > b+a) , false);
-
- test_members(a);
- //
- // Use in Boolean context:
- //
- a = 0;
- if(a)
- {
- BOOST_ERROR("Unexpected non-zero result");
- }
- if(!a){}
- else
- {
- BOOST_ERROR("Unexpected zero result");
- }
- b = 2;
- if(!b)
- {
- BOOST_ERROR("Unexpected zero result");
- }
- if(b){}
- else
- {
- BOOST_ERROR("Unexpected non-zero result");
- }
- if(a && b)
- {
- BOOST_ERROR("Unexpected zero result");
- }
- if(!(a || b))
- {
- BOOST_ERROR("Unexpected zero result");
- }
- if(a + b){}
- else
- {
- BOOST_ERROR("Unexpected zero result");
- }
- if(b - 2)
- {
- BOOST_ERROR("Unexpected non-zero result");
- }
- //
- // Test iostreams:
- //
- std::stringstream ss;
- a = 20;
- b = 2;
- ss << a;
- ss >> c;
- BOOST_CHECK_EQUAL(a , c);
- ss.clear();
- ss << a + b;
- ss >> c;
- BOOST_CHECK_EQUAL(c , 22);
- BOOST_CHECK_EQUAL(c , a + b);
- //
- // More cases for complete code coverage:
- //
- a = 20;
- b = 30;
- swap(a, b);
- BOOST_CHECK_EQUAL(a , 30);
- BOOST_CHECK_EQUAL(b , 20);
- a = 20;
- b = 30;
- std::swap(a, b);
- BOOST_CHECK_EQUAL(a , 30);
- BOOST_CHECK_EQUAL(b , 20);
- a = 20;
- b = 30;
- a = a + b * 2;
- BOOST_CHECK_EQUAL(a , 20 + 30 * 2);
- a = 100;
- a = a - b * 2;
- BOOST_CHECK_EQUAL(a , 100 - 30 * 2);
- a = 20;
- a = a * (b + 2);
- BOOST_CHECK_EQUAL(a , 20 * (32));
- a = 20;
- a = (b + 2) * a;
- BOOST_CHECK_EQUAL(a , 20 * (32));
- a = 90;
- b = 2;
- a = a / (b + 0);
- BOOST_CHECK_EQUAL(a , 45);
- a = 20;
- b = 30;
- c = (a * b) + 22;
- BOOST_CHECK_EQUAL(c , 20 * 30 + 22);
- c = 22 + (a * b);
- BOOST_CHECK_EQUAL(c , 20 * 30 + 22);
- c = 10;
- ac = a + b * c;
- BOOST_CHECK_EQUAL(ac , 20 + 30 * 10);
- ac = b * c + a;
- BOOST_CHECK_EQUAL(ac , 20 + 30 * 10);
- a = a + b * c;
- BOOST_CHECK_EQUAL(a , 20 + 30 * 10);
- a = 20;
- b = a + b * c;
- BOOST_CHECK_EQUAL(b , 20 + 30 * 10);
- b = 30;
- c = a + b * c;
- BOOST_CHECK_EQUAL(c , 20 + 30 * 10);
-
- //
- // Test conditionals:
- //
- a = 20;
- test_conditional(a, +a);
- test_conditional(a, (a + 0));
-
- test_signed_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
-}
-
-
-int main()
-{
-#ifdef TEST_ARITHMETIC_BACKEND
- test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<double> > >();
- test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<int> > >();
- test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<unsigned int> > >();
-#endif
-#ifdef TEST_BACKEND
- test<boost::multiprecision::number<boost::multiprecision::concepts::number_backend_float_architype> >();
-#endif
-#ifdef TEST_MPF_50
- test<boost::multiprecision::mpf_float_50>();
-#endif
-#ifdef TEST_MPF
- boost::multiprecision::mpf_float::default_precision(1000);
- BOOST_CHECK_EQUAL(boost::multiprecision::mpf_float::default_precision() , 1000);
- test<boost::multiprecision::mpf_float>();
-#endif
-#ifdef TEST_MPZ
- test<boost::multiprecision::mpz_int>();
- test<boost::multiprecision::number<boost::multiprecision::rational_adapter<boost::multiprecision::gmp_int> > >();
-#endif
-#ifdef TEST_MPQ
- test<boost::multiprecision::mpq_rational>();
-#endif
-#ifdef TEST_CPP_DEC_FLOAT
- test<boost::multiprecision::cpp_dec_float_50>();
- test<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100, long long>, boost::multiprecision::et_off> >();
- test<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100, long long, std::allocator<void> >, boost::multiprecision::et_on> >();
-#endif
-#ifdef TEST_MPFR
- test<boost::multiprecision::mpfr_float>();
-#endif
-#ifdef TEST_MPFR_50
- test<boost::multiprecision::mpfr_float_50>();
- test<boost::multiprecision::static_mpfr_float_50>();
-#endif
-#ifdef TEST_TOMMATH
- test<boost::multiprecision::tom_int>();
- test<boost::multiprecision::number<boost::multiprecision::rational_adapter<boost::multiprecision::tommath_int> > >();
-#endif
-#ifdef TEST_TOMMATH_BOOST_RATIONAL
- test<boost::rational<boost::multiprecision::tom_int> >();
-#endif
-#ifdef TEST_MPZ_BOOST_RATIONAL
- test<boost::rational<boost::multiprecision::mpz_int> >();
-#endif
-#ifdef TEST_CPP_INT_1
- test<boost::multiprecision::cpp_int>();
-#endif
-#ifdef TEST_CPP_INT_2
- test<boost::multiprecision::int512_t >();
-#endif
-#ifdef TEST_CPP_INT_3
- test<boost::multiprecision::uint1024_t >();
-#endif
-#ifdef TEST_CPP_INT_4
- test<boost::multiprecision::checked_cpp_int>();
-#endif
-#ifdef TEST_CPP_INT_5
- test<boost::multiprecision::checked_int512_t >();
-#endif
-#ifdef TEST_CPP_INT_6
- test<boost::multiprecision::checked_uint1024_t >();
-#endif
-#ifdef TEST_CPP_INT_7
- test<boost::multiprecision::cpp_rational>();
-#endif
-#ifdef TEST_CPP_INT_8
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off> >();
-#endif
-#ifdef TEST_CPP_INT_9
-test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<500, 500, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_10
- test<boost::multiprecision::checked_cpp_rational>();
-#endif
-#ifdef TEST_CPP_INT_11
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::checked>, boost::multiprecision::et_off> >();
-#endif
-#ifdef TEST_CPP_INT_12
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<500, 500, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_13
- // Again with "trivial" backends:
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_14
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_15
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<31, 31, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_16
- // Again with "trivial" checked backends:
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_17
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::checked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_18
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<31, 31, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
-#endif
-#ifdef TEST_CPP_INT_BR
- test<boost::rational<boost::multiprecision::cpp_int> >();
-#endif
- return boost::report_errors();
-}
-

Added: trunk/libs/multiprecision/test/test_arithmetic.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic.hpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,1638 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef TEST_VLD
+#include <vld.h>
+#endif
+
+#include <boost/math/special_functions/pow.hpp>
+#include <boost/math/common_factor_rt.hpp>
+#include "test.hpp"
+
+template <class T>
+struct is_boost_rational : public boost::mpl::false_{};
+
+#ifdef BOOST_MSVC
+// warning C4127: conditional expression is constant
+#pragma warning(disable:4127)
+#endif
+
+
+bool isfloat(float){ return true; }
+bool isfloat(double){ return true; }
+bool isfloat(long double){ return true; }
+template <class T> bool isfloat(T){ return false; }
+
+namespace detail{
+
+template<class tag, class Arg1, class Arg2, class Arg3, class Arg4>
+typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type
+ abs(boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> const& v)
+{
+ typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type result_type;
+ return v < 0 ? result_type(-v) : result_type(v);
+}
+
+}
+
+template <class T>
+struct is_twos_complement_integer : public boost::mpl::true_ {};
+
+template <class T>
+struct related_type
+{
+ typedef T type;
+};
+
+template <class Real, class Val>
+void test_comparisons(Val, Val, const boost::mpl::false_)
+{}
+
+int normalize_compare_result(int r)
+{
+ return r > 0 ? 1 : r < 0 ? -1 : 0;
+}
+
+template <class Real, class Val>
+void test_comparisons(Val a, Val b, const boost::mpl::true_)
+{
+ Real r1(a);
+ Real r2(b);
+ Real z(1);
+
+ int cr = a < b ? -1 : a > b ? 1 : 0;
+
+ BOOST_CHECK_EQUAL(r1 == r2, a == b);
+ BOOST_CHECK_EQUAL(r1 != r2, a != b);
+ BOOST_CHECK_EQUAL(r1 <= r2, a <= b);
+ BOOST_CHECK_EQUAL(r1 < r2, a < b);
+ BOOST_CHECK_EQUAL(r1 >= r2, a >= b);
+ BOOST_CHECK_EQUAL(r1 > r2, a > b);
+
+ BOOST_CHECK_EQUAL(r1 == b, a == b);
+ BOOST_CHECK_EQUAL(r1 != b, a != b);
+ BOOST_CHECK_EQUAL(r1 <= b, a <= b);
+ BOOST_CHECK_EQUAL(r1 < b, a < b);
+ BOOST_CHECK_EQUAL(r1 >= b, a >= b);
+ BOOST_CHECK_EQUAL(r1 > b, a > b);
+
+ BOOST_CHECK_EQUAL(a == r2, a == b);
+ BOOST_CHECK_EQUAL(a != r2, a != b);
+ BOOST_CHECK_EQUAL(a <= r2, a <= b);
+ BOOST_CHECK_EQUAL(a < r2, a < b);
+ BOOST_CHECK_EQUAL(a >= r2, a >= b);
+ BOOST_CHECK_EQUAL(a > r2, a > b);
+
+ BOOST_CHECK_EQUAL(r1*z == r2, a == b);
+ BOOST_CHECK_EQUAL(r1*z != r2, a != b);
+ BOOST_CHECK_EQUAL(r1*z <= r2, a <= b);
+ BOOST_CHECK_EQUAL(r1*z < r2, a < b);
+ BOOST_CHECK_EQUAL(r1*z >= r2, a >= b);
+ BOOST_CHECK_EQUAL(r1*z > r2, a > b);
+
+ BOOST_CHECK_EQUAL(r1 == r2*z, a == b);
+ BOOST_CHECK_EQUAL(r1 != r2*z, a != b);
+ BOOST_CHECK_EQUAL(r1 <= r2*z, a <= b);
+ BOOST_CHECK_EQUAL(r1 < r2*z, a < b);
+ BOOST_CHECK_EQUAL(r1 >= r2*z, a >= b);
+ BOOST_CHECK_EQUAL(r1 > r2*z, a > b);
+
+ BOOST_CHECK_EQUAL(r1*z == r2*z, a == b);
+ BOOST_CHECK_EQUAL(r1*z != r2*z, a != b);
+ BOOST_CHECK_EQUAL(r1*z <= r2*z, a <= b);
+ BOOST_CHECK_EQUAL(r1*z < r2*z, a < b);
+ BOOST_CHECK_EQUAL(r1*z >= r2*z, a >= b);
+ BOOST_CHECK_EQUAL(r1*z > r2*z, a > b);
+
+ BOOST_CHECK_EQUAL(r1*z == b, a == b);
+ BOOST_CHECK_EQUAL(r1*z != b, a != b);
+ BOOST_CHECK_EQUAL(r1*z <= b, a <= b);
+ BOOST_CHECK_EQUAL(r1*z < b, a < b);
+ BOOST_CHECK_EQUAL(r1*z >= b, a >= b);
+ BOOST_CHECK_EQUAL(r1*z > b, a > b);
+
+ BOOST_CHECK_EQUAL(a == r2*z, a == b);
+ BOOST_CHECK_EQUAL(a != r2*z, a != b);
+ BOOST_CHECK_EQUAL(a <= r2*z, a <= b);
+ BOOST_CHECK_EQUAL(a < r2*z, a < b);
+ BOOST_CHECK_EQUAL(a >= r2*z, a >= b);
+ BOOST_CHECK_EQUAL(a > r2*z, a > b);
+
+ BOOST_CHECK_EQUAL(normalize_compare_result(r1.compare(r2)), cr);
+ BOOST_CHECK_EQUAL(normalize_compare_result(r2.compare(r1)), -cr);
+ BOOST_CHECK_EQUAL(normalize_compare_result(r1.compare(b)), cr);
+ BOOST_CHECK_EQUAL(normalize_compare_result(r2.compare(a)), -cr);
+}
+
+template <class Real, class Exp>
+void test_conditional(Real v, Exp e)
+{
+ //
+ // Verify that Exp is usable in Boolean contexts, and has the same value as v:
+ //
+ if(e)
+ {
+ BOOST_CHECK(v);
+ }
+ else
+ {
+ BOOST_CHECK(!v);
+ }
+ if(!e)
+ {
+ BOOST_CHECK(!v);
+ }
+ else
+ {
+ BOOST_CHECK(v);
+ }
+}
+
+template <class Real>
+void test_complement(Real a, Real b, Real c, const boost::mpl::true_&)
+{
+ int i = 1020304;
+ int j = 56789123;
+ int sign_mask = ~0;
+ if(std::numeric_limits<Real>::is_signed)
+ {
+ BOOST_CHECK_EQUAL(~a , (~i & sign_mask));
+ c = a & ~b;
+ BOOST_CHECK_EQUAL(c , (i & (~j & sign_mask)));
+ c = ~(a | b);
+ BOOST_CHECK_EQUAL(c , (~(i | j) & sign_mask));
+ }
+ else
+ {
+ BOOST_CHECK_EQUAL((~a & a) , 0);
+ }
+}
+
+template <class Real>
+void test_complement(Real, Real, Real, const boost::mpl::false_&)
+{
+}
+
+template <class Real, class T>
+void test_integer_ops(const T&){}
+
+template <class Real>
+void test_rational(const boost::mpl::true_&)
+{
+ Real a(2);
+ a /= 3;
+ BOOST_CHECK_EQUAL(numerator(a) , 2);
+ BOOST_CHECK_EQUAL(denominator(a) , 3);
+ Real b(4);
+ b /= 6;
+ BOOST_CHECK_EQUAL(a , b);
+
+ //
+ // Check IO code:
+ //
+ std::stringstream ss;
+ ss << a;
+ ss >> b;
+ BOOST_CHECK_EQUAL(a, b);
+}
+
+template <class Real>
+void test_rational(const boost::mpl::false_&)
+{
+ Real a(2);
+ a /= 3;
+ BOOST_CHECK_EQUAL(numerator(a) , 2);
+ BOOST_CHECK_EQUAL(denominator(a) , 3);
+ Real b(4);
+ b /= 6;
+ BOOST_CHECK_EQUAL(a , b);
+
+ BOOST_CHECK_THROW(Real(a / 0), std::overflow_error);
+ BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
+ b = Real("2/3");
+ BOOST_CHECK_EQUAL(a, b);
+ //
+ // Check IO code:
+ //
+ std::stringstream ss;
+ ss << a;
+ ss >> b;
+ BOOST_CHECK_EQUAL(a, b);
+}
+
+template <class Real>
+void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
+{
+ test_rational<Real>(is_boost_rational<Real>());
+}
+
+template <class Real>
+void test_signed_integer_ops(const boost::mpl::true_&)
+{
+ Real a(20);
+ Real b(7);
+ Real c(5);
+ BOOST_CHECK_EQUAL(-a % c , 0);
+ BOOST_CHECK_EQUAL(-a % b , -20 % 7);
+ BOOST_CHECK_EQUAL(-a % -b , -20 % -7);
+ BOOST_CHECK_EQUAL(a % -b , 20 % -7);
+ BOOST_CHECK_EQUAL(-a % 7 , -20 % 7);
+ BOOST_CHECK_EQUAL(-a % -7 , -20 % -7);
+ BOOST_CHECK_EQUAL(a % -7 , 20 % -7);
+ BOOST_CHECK_EQUAL(-a % 7u , -20 % 7);
+ BOOST_CHECK_EQUAL(-a % a , 0);
+ BOOST_CHECK_EQUAL(-a % 5 , 0);
+ BOOST_CHECK_EQUAL(-a % -5 , 0);
+ BOOST_CHECK_EQUAL(a % -5 , 0);
+
+ b = -b;
+ BOOST_CHECK_EQUAL(a % b , 20 % -7);
+ a = -a;
+ BOOST_CHECK_EQUAL(a % b , -20 % -7);
+ BOOST_CHECK_EQUAL(a % -7 , -20 % -7);
+ b = 7;
+ BOOST_CHECK_EQUAL(a % b , -20 % 7);
+ BOOST_CHECK_EQUAL(a % 7 , -20 % 7);
+ BOOST_CHECK_EQUAL(a % 7u , -20 % 7);
+
+ a = 20;
+ a %= b;
+ BOOST_CHECK_EQUAL(a , 20 % 7);
+ a = -20;
+ a %= b;
+ BOOST_CHECK_EQUAL(a , -20 % 7);
+ a = 20;
+ a %= -b;
+ BOOST_CHECK_EQUAL(a , 20 % -7);
+ a = -20;
+ a %= -b;
+ BOOST_CHECK_EQUAL(a , -20 % -7);
+ a = 5;
+ a %= b - a;
+ BOOST_CHECK_EQUAL(a , 5 % (7-5));
+ a = -20;
+ a %= 7;
+ BOOST_CHECK_EQUAL(a , -20 % 7);
+ a = 20;
+ a %= -7;
+ BOOST_CHECK_EQUAL(a , 20 % -7);
+ a = -20;
+ a %= -7;
+ BOOST_CHECK_EQUAL(a , -20 % -7);
+#ifndef BOOST_NO_LONG_LONG
+ a = -20;
+ a %= 7uLL;
+ BOOST_CHECK_EQUAL(a , -20 % 7);
+ a = 20;
+ a %= -7LL;
+ BOOST_CHECK_EQUAL(a , 20 % -7);
+ a = -20;
+ a %= -7LL;
+ BOOST_CHECK_EQUAL(a , -20 % -7);
+#endif
+ a = 400;
+ b = 45;
+ BOOST_CHECK_EQUAL(gcd(a, -45) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, -45) , boost::math::lcm(400, 45));
+ BOOST_CHECK_EQUAL(gcd(-400, b) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(-400, b) , boost::math::lcm(400, 45));
+ a = -20;
+ BOOST_CHECK_EQUAL(abs(a) , 20);
+ BOOST_CHECK_EQUAL(abs(-a) , 20);
+ BOOST_CHECK_EQUAL(abs(+a) , 20);
+ a = 20;
+ BOOST_CHECK_EQUAL(abs(a) , 20);
+ BOOST_CHECK_EQUAL(abs(-a) , 20);
+ BOOST_CHECK_EQUAL(abs(+a) , 20);
+ a = -400;
+ b = 45;
+ BOOST_CHECK_EQUAL(gcd(a, b) , boost::math::gcd(-400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, b) , boost::math::lcm(-400, 45));
+ BOOST_CHECK_EQUAL(gcd(a, 45) , boost::math::gcd(-400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, 45) , boost::math::lcm(-400, 45));
+ BOOST_CHECK_EQUAL(gcd(-400, b) , boost::math::gcd(-400, 45));
+ BOOST_CHECK_EQUAL(lcm(-400, b) , boost::math::lcm(-400, 45));
+ Real r;
+ divide_qr(a, b, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ BOOST_CHECK_EQUAL(integer_modulus(a, 57) , abs(a % 57));
+ b = -57;
+ divide_qr(a, b, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ BOOST_CHECK_EQUAL(integer_modulus(a, -57) , abs(a % -57));
+ a = 458;
+ divide_qr(a, b, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ BOOST_CHECK_EQUAL(integer_modulus(a, -57) , abs(a % -57));
+}
+template <class Real>
+void test_signed_integer_ops(const boost::mpl::false_&)
+{
+}
+
+template <class Real>
+void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
+{
+ test_signed_integer_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
+
+ Real a(20);
+ Real b(7);
+ Real c(5);
+ BOOST_CHECK_EQUAL(a % b , 20 % 7);
+ BOOST_CHECK_EQUAL(a % 7 , 20 % 7);
+ BOOST_CHECK_EQUAL(a % 7u , 20 % 7);
+ BOOST_CHECK_EQUAL(a % a , 0);
+ BOOST_CHECK_EQUAL(a % c , 0);
+ BOOST_CHECK_EQUAL(a % 5 , 0);
+ a = a % (b + 0);
+ BOOST_CHECK_EQUAL(a , 20 % 7);
+ a = 20;
+ c = (a + 2) % (a - 1);
+ BOOST_CHECK_EQUAL(c , 22 % 19);
+ c = 5;
+ a = b % (a - 15);
+ BOOST_CHECK_EQUAL(a , 7 % 5);
+ a = 20;
+
+ a = 20;
+ a %= 7;
+ BOOST_CHECK_EQUAL(a , 20 % 7);
+#ifndef BOOST_NO_LONG_LONG
+ a = 20;
+ a %= 7uLL;
+ BOOST_CHECK_EQUAL(a , 20 % 7);
+#endif
+ a = 20;
+ BOOST_CHECK_EQUAL(++a , 21);
+ BOOST_CHECK_EQUAL(--a , 20);
+ BOOST_CHECK_EQUAL(a++ , 20);
+ BOOST_CHECK_EQUAL(a , 21);
+ BOOST_CHECK_EQUAL(a-- , 21);
+ BOOST_CHECK_EQUAL(a , 20);
+ a = 2000;
+ a <<= 20;
+ BOOST_CHECK_EQUAL(a , 2000L << 20);
+ a >>= 20;
+ BOOST_CHECK_EQUAL(a , 2000);
+ a <<= 20u;
+ BOOST_CHECK_EQUAL(a , 2000L << 20);
+ a >>= 20u;
+ BOOST_CHECK_EQUAL(a , 2000);
+ BOOST_CHECK_THROW(a <<= -20, std::out_of_range);
+ BOOST_CHECK_THROW(a >>= -20, std::out_of_range);
+ BOOST_CHECK_THROW(Real(a << -20), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a >> -20), std::out_of_range);
+#ifndef BOOST_NO_LONG_LONG
+ if(sizeof(long long) > sizeof(std::size_t))
+ {
+ // extreme values should trigger an exception:
+ BOOST_CHECK_THROW(a >>= (1uLL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ BOOST_CHECK_THROW(a <<= (1uLL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ BOOST_CHECK_THROW(a >>= -(1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ BOOST_CHECK_THROW(a <<= -(1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ BOOST_CHECK_THROW(a >>= (1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ BOOST_CHECK_THROW(a <<= (1LL << (sizeof(long long) * CHAR_BIT - 2)), std::out_of_range);
+ // Unless they fit within range:
+ a = 2000L;
+ BOOST_CHECK_EQUAL((a <<= 20uLL) , (2000L << 20));
+ a = 2000;
+ BOOST_CHECK_EQUAL((a <<= 20LL) , (2000L << 20));
+
+ BOOST_CHECK_THROW(Real(a >> (1uLL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a <<= (1uLL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a >>= -(1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a <<= -(1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a >>= (1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ BOOST_CHECK_THROW(Real(a <<= (1LL << (sizeof(long long) * CHAR_BIT - 2))), std::out_of_range);
+ // Unless they fit within range:
+ a = 2000L;
+ BOOST_CHECK_EQUAL(Real(a << 20uLL) , (2000L << 20));
+ a = 2000;
+ BOOST_CHECK_EQUAL(Real(a << 20LL) , (2000L << 20));
+ }
+#endif
+ a = 20;
+ b = a << 20;
+ BOOST_CHECK_EQUAL(b , (20 << 20));
+ b = a >> 2;
+ BOOST_CHECK_EQUAL(b , (20 >> 2));
+ b = (a + 2) << 10;
+ BOOST_CHECK_EQUAL(b , (22 << 10));
+ b = (a + 3) >> 3;
+ BOOST_CHECK_EQUAL(b , (23 >> 3));
+ //
+ // Bit fiddling:
+ //
+ int i = 1020304;
+ int j = 56789123;
+ int k = 4523187;
+ a = i;
+ b = j;
+ c = a;
+ c &= b;
+ BOOST_CHECK_EQUAL(c , (i & j));
+ c = a;
+ c &= j;
+ BOOST_CHECK_EQUAL(c , (i & j));
+ c = a;
+ c &= a + b;
+ BOOST_CHECK_EQUAL(c , (i & (i + j)));
+ BOOST_CHECK_EQUAL((a & b) , (i & j));
+ c = k;
+ a = a & (b + k);
+ BOOST_CHECK_EQUAL(a , (i & (j + k)));
+ a = i;
+ a = (b + k) & a;
+ BOOST_CHECK_EQUAL(a , (i & (j + k)));
+ a = i;
+ c = a & b & k;
+ BOOST_CHECK_EQUAL(c , (i&j&k));
+ c = a;
+ c &= (c+b);
+ BOOST_CHECK_EQUAL(c , (i & (i+j)));
+ c = a & (b | 1);
+ BOOST_CHECK_EQUAL(c , (i & (j | 1)));
+
+ test_complement<Real>(a, b, c, typename is_twos_complement_integer<Real>::type());
+
+ a = i;
+ b = j;
+ c = a;
+ c |= b;
+ BOOST_CHECK_EQUAL(c , (i | j));
+ c = a;
+ c |= j;
+ BOOST_CHECK_EQUAL(c , (i | j));
+ c = a;
+ c |= a + b;
+ BOOST_CHECK_EQUAL(c , (i | (i + j)));
+ BOOST_CHECK_EQUAL((a | b) , (i | j));
+ c = k;
+ a = a | (b + k);
+ BOOST_CHECK_EQUAL(a , (i | (j + k)));
+ a = i;
+ a = (b + k) | a;
+ BOOST_CHECK_EQUAL(a , (i | (j + k)));
+ a = i;
+ c = a | b | k;
+ BOOST_CHECK_EQUAL(c , (i|j|k));
+ c = a;
+ c |= (c + b);
+ BOOST_CHECK_EQUAL(c , (i | (i+j)));
+ c = a | (b | 1);
+ BOOST_CHECK_EQUAL(c , (i | (j | 1)));
+
+ a = i;
+ b = j;
+ c = a;
+ c ^= b;
+ BOOST_CHECK_EQUAL(c , (i ^ j));
+ c = a;
+ c ^= j;
+ BOOST_CHECK_EQUAL(c , (i ^ j));
+ c = a;
+ c ^= a + b;
+ BOOST_CHECK_EQUAL(c , (i ^ (i + j)));
+ BOOST_CHECK_EQUAL((a ^ b) , (i ^ j));
+ c = k;
+ a = a ^ (b + k);
+ BOOST_CHECK_EQUAL(a , (i ^ (j + k)));
+ a = i;
+ a = (b + k) ^ a;
+ BOOST_CHECK_EQUAL(a , (i ^ (j + k)));
+ a = i;
+ c = a ^ b ^ k;
+ BOOST_CHECK_EQUAL(c , (i^j^k));
+ c = a;
+ c ^= (c + b);
+ BOOST_CHECK_EQUAL(c , (i ^ (i+j)));
+ c = a ^ (b | 1);
+ BOOST_CHECK_EQUAL(c , (i ^ (j | 1)));
+
+ a = i;
+ b = j;
+ c = k;
+ //
+ // Non-member functions:
+ //
+ a = 400;
+ b = 45;
+ BOOST_CHECK_EQUAL(gcd(a, b) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, b) , boost::math::lcm(400, 45));
+ BOOST_CHECK_EQUAL(gcd(a, 45) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, 45) , boost::math::lcm(400, 45));
+ BOOST_CHECK_EQUAL(gcd(a, 45u) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(a, 45u) , boost::math::lcm(400, 45));
+ BOOST_CHECK_EQUAL(gcd(400, b) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(400, b) , boost::math::lcm(400, 45));
+ BOOST_CHECK_EQUAL(gcd(400u, b) , boost::math::gcd(400, 45));
+ BOOST_CHECK_EQUAL(lcm(400u, b) , boost::math::lcm(400, 45));
+
+ //
+ // Conditionals involving 2 arg functions:
+ //
+ test_conditional(Real(gcd(a, b)), gcd(a, b));
+
+ Real r;
+ divide_qr(a, b, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ divide_qr(a + 0, b, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ divide_qr(a, b+0, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ divide_qr(a+0, b+0, c, r);
+ BOOST_CHECK_EQUAL(c , a / b);
+ BOOST_CHECK_EQUAL(r , a % b);
+ BOOST_CHECK_EQUAL(integer_modulus(a, 57) , a % 57);
+ for(unsigned i = 0; i < 20; ++i)
+ {
+ if(std::numeric_limits<Real>::is_specialized && (!std::numeric_limits<Real>::is_bounded || ((int)i * 17 < std::numeric_limits<Real>::digits)))
+ {
+ BOOST_CHECK_EQUAL(lsb(Real(1) << (i * 17)) , i * 17);
+ BOOST_CHECK(bit_test(Real(1) << (i * 17), i * 17));
+ BOOST_CHECK(!bit_test(Real(1) << (i * 17), i * 17 + 1));
+ if(i)
+ {
+ BOOST_CHECK(!bit_test(Real(1) << (i * 17), i * 17 - 1));
+ }
+ Real zero(0);
+ BOOST_CHECK(bit_test(bit_set(zero, i * 17), i * 17));
+ zero = 0;
+ BOOST_CHECK_EQUAL(bit_flip(zero, i*17) , Real(1) << i * 17);
+ zero = Real(1) << i * 17;
+ BOOST_CHECK_EQUAL(bit_flip(zero, i * 17) , 0);
+ zero = Real(1) << i * 17;
+ BOOST_CHECK_EQUAL(bit_unset(zero, i * 17) , 0);
+ }
+ }
+ //
+ // pow, powm:
+ //
+ BOOST_CHECK_EQUAL(pow(Real(3), 4) , 81);
+ BOOST_CHECK_EQUAL(pow(Real(3) + Real(0), 4) , 81);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4), Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4), 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4), Real(13) + 0) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), Real(4) + 0, Real(13) + 0) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3), 4 + 0, Real(13) + 0) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4), Real(13) + 0) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, Real(4) + 0, Real(13) + 0) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, Real(13)) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, 13) , 81 % 13);
+ BOOST_CHECK_EQUAL(powm(Real(3) + 0, 4 + 0, Real(13) + 0) , 81 % 13);
+ //
+ // Conditionals involving 3 arg functions:
+ //
+ test_conditional(Real(powm(Real(3), Real(4), Real(13))), powm(Real(3), Real(4), Real(13)));
+
+ //
+ // Things that are expected errors:
+ //
+ BOOST_CHECK_THROW(Real("3.14"), std::runtime_error);
+ BOOST_CHECK_THROW(Real("3L"), std::runtime_error);
+ BOOST_CHECK_THROW(Real(Real(20) / 0u), std::overflow_error);
+ //
+ // Extra tests added for full coverage:
+ //
+ a = 20;
+ b = 7;
+ c = 20 % b;
+ BOOST_CHECK_EQUAL(c , (20 % 7));
+ c = 20 % (b + 0);
+ BOOST_CHECK_EQUAL(c , (20 % 7));
+ c = a & 10;
+ BOOST_CHECK_EQUAL(c , (20 & 10));
+ c = 10 & a;
+ BOOST_CHECK_EQUAL(c , (20 & 10));
+ c = (a + 0) & (b + 0);
+ BOOST_CHECK_EQUAL(c , (20 & 7));
+ c = 10 & (a + 0);
+ BOOST_CHECK_EQUAL(c , (20 & 10));
+ c = 10 | a;
+ BOOST_CHECK_EQUAL(c , (20 | 10));
+ c = (a + 0) | (b + 0);
+ BOOST_CHECK(c == (20 | 7))
+ c = 20 | (b + 0);
+ BOOST_CHECK_EQUAL(c , (20 | 7));
+ c = a ^ 7;
+ BOOST_CHECK_EQUAL(c , (20 ^ 7));
+ c = 20 ^ b;
+ BOOST_CHECK_EQUAL(c , (20 ^ 7));
+ c = (a + 0) ^ (b + 0);
+ BOOST_CHECK_EQUAL(c , (20 ^ 7));
+ c = 20 ^ (b + 0);
+ BOOST_CHECK_EQUAL(c , (20 ^ 7));
+}
+
+template <class Real, class T>
+void test_float_ops(const T&){}
+
+template <class Real>
+void test_float_ops(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
+{
+ BOOST_CHECK_EQUAL(abs(Real(2)) , 2);
+ BOOST_CHECK_EQUAL(abs(Real(-2)) , 2);
+ BOOST_CHECK_EQUAL(fabs(Real(2)) , 2);
+ BOOST_CHECK_EQUAL(fabs(Real(-2)) , 2);
+ BOOST_CHECK_EQUAL(floor(Real(5) / 2) , 2);
+ BOOST_CHECK_EQUAL(ceil(Real(5) / 2) , 3);
+ BOOST_CHECK_EQUAL(floor(Real(-5) / 2) , -3);
+ BOOST_CHECK_EQUAL(ceil(Real(-5) / 2) , -2);
+ BOOST_CHECK_EQUAL(trunc(Real(5) / 2) , 2);
+ BOOST_CHECK_EQUAL(trunc(Real(-5) / 2) , -2);
+ //
+ // ldexp and frexp, these pretty much have to be implemented by each backend:
+ //
+ BOOST_CHECK_EQUAL(ldexp(Real(2), 5) , 64);
+ BOOST_CHECK_EQUAL(ldexp(Real(2), -5) , Real(2) / 32);
+ Real v(512);
+ int exp;
+ Real r = frexp(v, &exp);
+ BOOST_CHECK_EQUAL(r , 0.5);
+ BOOST_CHECK_EQUAL(exp , 10);
+ BOOST_CHECK_EQUAL(v , 512);
+ v = 1 / v;
+ r = frexp(v, &exp);
+ BOOST_CHECK_EQUAL(r , 0.5);
+ BOOST_CHECK_EQUAL(exp , -8);
+ typedef typename Real::backend_type::exponent_type e_type;
+ BOOST_CHECK_EQUAL(ldexp(Real(2), e_type(5)) , 64);
+ BOOST_CHECK_EQUAL(ldexp(Real(2), e_type(-5)) , Real(2) / 32);
+ v = 512;
+ e_type exp2;
+ r = frexp(v, &exp2);
+ BOOST_CHECK_EQUAL(r , 0.5);
+ BOOST_CHECK_EQUAL(exp2 , 10);
+ BOOST_CHECK_EQUAL(v , 512);
+ v = 1 / v;
+ r = frexp(v, &exp2);
+ BOOST_CHECK_EQUAL(r , 0.5);
+ BOOST_CHECK_EQUAL(exp2 , -8);
+ //
+ // pow and exp:
+ //
+ v = 3.25;
+ r = pow(v, 0);
+ BOOST_CHECK_EQUAL(r , 1);
+ r = pow(v, 1);
+ BOOST_CHECK_EQUAL(r , 3.25);
+ r = pow(v, 2);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<2>(3.25));
+ r = pow(v, 3);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<3>(3.25));
+ r = pow(v, 4);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<4>(3.25));
+ r = pow(v, 5);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<5>(3.25));
+ r = pow(v, 6);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<6>(3.25));
+ r = pow(v, 25);
+ BOOST_CHECK_EQUAL(r , boost::math::pow<25>(Real(3.25)));
+ //
+ // Things that are expected errors:
+ //
+ BOOST_CHECK_THROW(Real("3.14L"), std::runtime_error);
+ if(std::numeric_limits<Real>::is_specialized)
+ {
+ if(std::numeric_limits<Real>::has_infinity)
+ {
+ BOOST_CHECK(boost::math::isinf(Real(20) / 0u));
+ }
+ else
+ {
+ BOOST_CHECK_THROW(Real(Real(20) / 0u), std::overflow_error);
+ }
+ }
+}
+
+template <class T>
+struct lexical_cast_target_type
+{
+ typedef typename boost::mpl::if_<
+ boost::is_signed<T>,
+ boost::intmax_t,
+ typename boost::mpl::if_<
+ boost::is_unsigned<T>,
+ boost::uintmax_t,
+ T
+ >::type
+ >::type type;
+};
+
+template <class Real, class Num>
+void test_negative_mixed(boost::mpl::true_ const&)
+{
+ typedef typename lexical_cast_target_type<Num>::type target_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
+ Real
+ >::type cast_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ Num,
+ Real
+ >::type simple_cast_type;
+ std::cout << "Testing mixed arithmetic with type: " << typeid(Real).name() << " and " << typeid(Num).name() << std::endl;
+ static const int left_shift = std::numeric_limits<Num>::digits - 1;
+ Num n1 = -static_cast<Num>(1uLL << ((left_shift < 63) && (left_shift > 0) ? left_shift : 10));
+ Num n2 = -1;
+ Num n3 = 0;
+ Num n4 = -20;
+ Num n5 = -8;
+
+ test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
+
+ // Default construct:
+ BOOST_CHECK_EQUAL(Real(n1) , static_cast<cast_type>(n1));
+ BOOST_CHECK_EQUAL(Real(n2) , static_cast<cast_type>(n2));
+ BOOST_CHECK_EQUAL(Real(n3) , static_cast<cast_type>(n3));
+ BOOST_CHECK_EQUAL(Real(n4) , static_cast<cast_type>(n4));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n1) , Real(n1));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n2) , Real(n2));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n3) , Real(n3));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n4) , Real(n4));
+ BOOST_CHECK_EQUAL(Real(n1).template convert_to<Num>() , n1);
+ BOOST_CHECK_EQUAL(Real(n2).template convert_to<Num>() , n2);
+ BOOST_CHECK_EQUAL(Real(n3).template convert_to<Num>() , n3);
+ BOOST_CHECK_EQUAL(Real(n4).template convert_to<Num>() , n4);
+#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n1)) , n1);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n2)) , n2);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n3)) , n3);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n4)) , n4);
+#endif
+#if defined(TEST_MPFR)
+ Num tol = 10 * std::numeric_limits<Num>::epsilon();
+#else
+ Num tol = 0;
+#endif
+ std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
+ if(std::numeric_limits<target_type>::digits <= std::numeric_limits<Real>::digits)
+ {
+ BOOST_CHECK_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
+ }
+ BOOST_CHECK_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
+ BOOST_CHECK_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
+ BOOST_CHECK_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
+ // Assignment:
+ Real r(0);
+ BOOST_CHECK(r != static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2));
+ r = static_cast<simple_cast_type>(n3);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n3));
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
+ // Addition:
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r + static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 + n4));
+ BOOST_CHECK_EQUAL(Real(r + static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 + n4));
+ r += static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 + n4));
+ // subtraction:
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r - static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n4 - n5));
+ BOOST_CHECK_EQUAL(Real(r - static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n4 - n5));
+ r -= static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
+ // Multiplication:
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r * static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 * n4));
+ BOOST_CHECK_EQUAL(Real(r * static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 * n4));
+ r *= static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 * n4));
+ // Division:
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_CHECK_EQUAL(r / static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n1 / n5));
+ BOOST_CHECK_EQUAL(Real(r / static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n1 / n5));
+ r /= static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1 / n5));
+ //
+ // Extra cases for full coverage:
+ //
+ r = Real(n4) + static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
+ r = static_cast<simple_cast_type>(n4) + Real(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
+ r = Real(n4) - static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) - Real(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) * Real(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 * n5));
+ r = static_cast<cast_type>(4 * n4) / Real(4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
+
+ Real a, b, c;
+ a = 20;
+ b = 30;
+ c = -a + b;
+ BOOST_CHECK_EQUAL(c , 10);
+ c = b + -a;
+ BOOST_CHECK_EQUAL(c , 10);
+ n4 = 30;
+ c = -a + static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , 10);
+ c = static_cast<cast_type>(n4) + -a;
+ BOOST_CHECK_EQUAL(c , 10);
+ c = -a + -b;
+ BOOST_CHECK_EQUAL(c , -50);
+ n4 = 4;
+ c = -(a + b) + static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , -50+4);
+ n4 = 50;
+ c = (a + b) - static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , 0);
+ c = (a + b) - static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , 0);
+ c = a - -(b + static_cast<cast_type>(n4));
+ BOOST_CHECK_EQUAL(c , 20 - -(30 + 50));
+ c = -(b + static_cast<cast_type>(n4)) - a;
+ BOOST_CHECK_EQUAL(c , -(30 + 50) - 20);
+ c = a - -b;
+ BOOST_CHECK_EQUAL(c , 50);
+ c = -a - b;
+ BOOST_CHECK_EQUAL(c , -50);
+ c = -a - static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , -20 - 50);
+ c = static_cast<cast_type>(n4) - -a;
+ BOOST_CHECK_EQUAL(c , 50 + 20);
+ c = -(a + b) - Real(n4);
+ BOOST_CHECK_EQUAL(c , -(20 + 30) - 50);
+ c = static_cast<cast_type>(n4) - (a + b);
+ BOOST_CHECK_EQUAL(c , 0);
+ c = (a + b) * static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , 50 * 50);
+ c = static_cast<cast_type>(n4) * (a + b);
+ BOOST_CHECK_EQUAL(c , 50 * 50);
+ c = a * -(b + static_cast<cast_type>(n4));
+ BOOST_CHECK_EQUAL(c , 20 * -(30 + 50));
+ c = -(b + static_cast<cast_type>(n4)) * a;
+ BOOST_CHECK_EQUAL(c , 20 * -(30 + 50));
+ c = a * -b;
+ BOOST_CHECK_EQUAL(c , 20 * -30);
+ c = -a * b;
+ BOOST_CHECK_EQUAL(c , 20 * -30);
+ c = -a * static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , -20 * 50);
+ c = static_cast<cast_type>(n4) * -a;
+ BOOST_CHECK_EQUAL(c , -20 * 50);
+ c = -(a + b) + a;
+ BOOST_CHECK(-50 + 20);
+ c = static_cast<cast_type>(n4) - (a + b);
+ BOOST_CHECK_EQUAL(c , 0);
+ Real d = 10;
+ c = (a + b) / d;
+ BOOST_CHECK_EQUAL(c , 5);
+ c = (a + b) / (d + 0);
+ BOOST_CHECK_EQUAL(c , 5);
+ c = (a + b) / static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , 1);
+ c = static_cast<cast_type>(n4) / (a + b);
+ BOOST_CHECK_EQUAL(c , 1);
+ d = 50;
+ c = d / -(a + b);
+ BOOST_CHECK_EQUAL(c , -1);
+ c = -(a + b) / d;
+ BOOST_CHECK_EQUAL(c , -1);
+ d = 2;
+ c = a / -d;
+ BOOST_CHECK_EQUAL(c , 20 / -2);
+ c = -a / d;
+ BOOST_CHECK_EQUAL(c , 20 / -2);
+ d = 50;
+ c = -d / static_cast<cast_type>(n4);
+ BOOST_CHECK_EQUAL(c , -1);
+ c = static_cast<cast_type>(n4) / -d;
+ BOOST_CHECK_EQUAL(c , -1);
+ c = static_cast<cast_type>(n4) + a;
+ BOOST_CHECK_EQUAL(c , 70);
+ c = static_cast<cast_type>(n4) - a;
+ BOOST_CHECK_EQUAL(c , 30);
+ c = static_cast<cast_type>(n4) * a;
+ BOOST_CHECK_EQUAL(c , 50 * 20);
+
+ n1 = -2;
+ n2 = -3;
+ n3 = -4;
+ a = static_cast<cast_type>(n1);
+ b = static_cast<cast_type>(n2);
+ c = static_cast<cast_type>(n3);
+ d = a + b * c;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + b * c;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = a + static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = a + b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ a += static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(a , -2 + -3 * -4);
+ a = static_cast<cast_type>(n1);
+ a += b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(a , -2 + -3 * -4);
+ a = static_cast<cast_type>(n1);
+
+ d = b * c + a;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = b * c + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = static_cast<cast_type>(n2) * c + a;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = b * static_cast<cast_type>(n3) + a;
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+ d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -2 + -3 * -4);
+
+ a = -20;
+ d = a - b * c;
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ n1 = -20;
+ d = static_cast<cast_type>(n1) - b * c;
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ d = a - static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ d = a - b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , -20 - -3 * -4);
+ a -= static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(a , -20 - -3 * -4);
+ a = static_cast<cast_type>(n1);
+ a -= b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(a , -20 - -3 * -4);
+
+ a = -2;
+ d = b * c - a;
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+ n1 = -2;
+ d = b * c - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+ d = static_cast<cast_type>(n2) * c - a;
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+ d = b * static_cast<cast_type>(n3) - a;
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+ d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+ d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , -3 * -4 - -2);
+}
+
+template <class Real, class Num>
+void test_negative_mixed(boost::mpl::false_ const&)
+{
+}
+
+template <class Real, class Num>
+void test_mixed(const boost::mpl::false_&)
+{
+}
+
+template <class Real, class Num>
+void test_mixed(const boost::mpl::true_&)
+{
+ typedef typename lexical_cast_target_type<Num>::type target_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ typename boost::mpl::if_c<boost::is_integral<Num>::value && (sizeof(Num) < sizeof(int)), int, Num>::type,
+ Real
+ >::type cast_type;
+ typedef typename boost::mpl::if_<
+ boost::is_convertible<Num, Real>,
+ Num,
+ Real
+ >::type simple_cast_type;
+
+ if(std::numeric_limits<Real>::is_specialized && std::numeric_limits<Real>::is_bounded && std::numeric_limits<Real>::digits < std::numeric_limits<Num>::digits)
+ return;
+
+ std::cout << "Testing mixed arithmetic with type: " << typeid(Real).name() << " and " << typeid(Num).name() << std::endl;
+ static const int left_shift = std::numeric_limits<Num>::digits - 1;
+ Num n1 = static_cast<Num>(1uLL << ((left_shift < 63) && (left_shift > 0) ? left_shift : 10));
+ Num n2 = 1;
+ Num n3 = 0;
+ Num n4 = 20;
+ Num n5 = 8;
+
+ test_comparisons<Real>(n1, n2, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n3, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n1, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n2, n1, boost::is_convertible<Num, Real>());
+ test_comparisons<Real>(n3, n3, boost::is_convertible<Num, Real>());
+
+ // Default construct:
+ BOOST_CHECK_EQUAL(Real(n1) , static_cast<cast_type>(n1));
+ BOOST_CHECK_EQUAL(Real(n2) , static_cast<cast_type>(n2));
+ BOOST_CHECK_EQUAL(Real(n3) , static_cast<cast_type>(n3));
+ BOOST_CHECK_EQUAL(Real(n4) , static_cast<cast_type>(n4));
+ BOOST_CHECK_EQUAL(Real(n1).template convert_to<Num>() , n1);
+ BOOST_CHECK_EQUAL(Real(n2).template convert_to<Num>() , n2);
+ BOOST_CHECK_EQUAL(Real(n3).template convert_to<Num>() , n3);
+ BOOST_CHECK_EQUAL(Real(n4).template convert_to<Num>() , n4);
+#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n1)) , n1);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n2)) , n2);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n3)) , n3);
+ BOOST_CHECK_EQUAL(static_cast<Num>(Real(n4)) , n4);
+#endif
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n1) , Real(n1));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n2) , Real(n2));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n3) , Real(n3));
+ BOOST_CHECK_EQUAL(static_cast<cast_type>(n4) , Real(n4));
+#if defined(TEST_MPFR)
+ Num tol = 10 * std::numeric_limits<Num>::epsilon();
+#else
+ Num tol = 0;
+#endif
+ std::ios_base::fmtflags f = boost::is_floating_point<Num>::value ? std::ios_base::scientific : std::ios_base::fmtflags(0);
+ if(std::numeric_limits<target_type>::digits <= std::numeric_limits<Real>::digits)
+ {
+ BOOST_CHECK_CLOSE(n1, boost::lexical_cast<target_type>(Real(n1).str(0, f)), tol);
+ }
+ BOOST_CHECK_CLOSE(n2, boost::lexical_cast<target_type>(Real(n2).str(0, f)), 0);
+ BOOST_CHECK_CLOSE(n3, boost::lexical_cast<target_type>(Real(n3).str(0, f)), 0);
+ BOOST_CHECK_CLOSE(n4, boost::lexical_cast<target_type>(Real(n4).str(0, f)), 0);
+ // Assignment:
+ Real r(0);
+ BOOST_CHECK(r != static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1));
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2));
+ r = static_cast<simple_cast_type>(n3);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n3));
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
+ // Addition:
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r + static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 + n4));
+ BOOST_CHECK_EQUAL(Real(r + static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 + n4));
+ r += static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 + n4));
+ // subtraction:
+ r = static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r - static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n4 - n5));
+ BOOST_CHECK_EQUAL(Real(r - static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n4 - n5));
+ r -= static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
+ // Multiplication:
+ r = static_cast<simple_cast_type>(n2);
+ BOOST_CHECK_EQUAL(r * static_cast<simple_cast_type>(n4) , static_cast<cast_type>(n2 * n4));
+ BOOST_CHECK_EQUAL(Real(r * static_cast<simple_cast_type>(n4)) , static_cast<cast_type>(n2 * n4));
+ r *= static_cast<simple_cast_type>(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n2 * n4));
+ // Division:
+ r = static_cast<simple_cast_type>(n1);
+ BOOST_CHECK_EQUAL(r / static_cast<simple_cast_type>(n5) , static_cast<cast_type>(n1 / n5));
+ BOOST_CHECK_EQUAL(Real(r / static_cast<simple_cast_type>(n5)) , static_cast<cast_type>(n1 / n5));
+ r /= static_cast<simple_cast_type>(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n1 / n5));
+ //
+ // special cases for full coverage:
+ //
+ r = static_cast<simple_cast_type>(n5) + Real(n4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 + n5));
+ r = static_cast<simple_cast_type>(n4) - Real(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 - n5));
+ r = static_cast<simple_cast_type>(n4) * Real(n5);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4 * n5));
+ r = static_cast<cast_type>(4 * n4) / Real(4);
+ BOOST_CHECK_EQUAL(r , static_cast<cast_type>(n4));
+
+ typedef boost::mpl::bool_<
+ (!std::numeric_limits<Num>::is_specialized || std::numeric_limits<Num>::is_signed)
+ && (!std::numeric_limits<Real>::is_specialized || std::numeric_limits<Real>::is_signed)> signed_tag;
+
+ test_negative_mixed<Real, Num>(signed_tag());
+
+ n1 = 2;
+ n2 = 3;
+ n3 = 4;
+ Real a(n1), b(n2), c(n3), d;
+ d = a + b * c;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + b * c;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = a + static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = a + b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ a += static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(a , 2 + 3 * 4);
+ a = static_cast<cast_type>(n1);
+ a += b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(a , 2 + 3 * 4);
+ a = static_cast<cast_type>(n1);
+
+ d = b * c + a;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = b * c + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = static_cast<cast_type>(n2) * c + a;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = b * static_cast<cast_type>(n3) + a;
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+ d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 2 + 3 * 4);
+
+ a = 20;
+ d = a - b * c;
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ n1 = 20;
+ d = static_cast<cast_type>(n1) - b * c;
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ d = a - static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ d = a - b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(d , 20 - 3 * 4);
+ a -= static_cast<cast_type>(n2) * c;
+ BOOST_CHECK_EQUAL(a , 20 - 3 * 4);
+ a = static_cast<cast_type>(n1);
+ a -= b * static_cast<cast_type>(n3);
+ BOOST_CHECK_EQUAL(a , 20 - 3 * 4);
+
+ a = 2;
+ d = b * c - a;
+ BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
+ n1 = 2;
+ d = b * c - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
+ d = static_cast<cast_type>(n2) * c - a;
+ BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
+ d = b * static_cast<cast_type>(n3) - a;
+ BOOST_CHECK_EQUAL(d , 3 * 4 - a);
+ d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
+ d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
+ BOOST_CHECK_EQUAL(d , 3 * 4 - 2);
+}
+
+template <class Real>
+void test_members(Real)
+{
+ //
+ // Test sign and zero functions:
+ //
+ Real a = 20;
+ Real b = 30;
+ BOOST_CHECK(a.sign() > 0);
+ BOOST_CHECK(!a.is_zero());
+ if(std::numeric_limits<Real>::is_signed)
+ {
+ a = -20;
+ BOOST_CHECK(a.sign() < 0);
+ BOOST_CHECK(!a.is_zero());
+ }
+ a = 0;
+ BOOST_CHECK_EQUAL(a.sign() , 0);
+ BOOST_CHECK(a.is_zero());
+
+ a = 20;
+ b = 30;
+ a.swap(b);
+ BOOST_CHECK_EQUAL(a , 30);
+ BOOST_CHECK_EQUAL(b , 20);
+}
+
+template <class Real>
+void test_members(boost::rational<Real>)
+{
+}
+
+template <class Real>
+void test_signed_ops(const boost::mpl::true_&)
+{
+ Real a(8);
+ Real b(64);
+ Real c(500);
+ Real d(1024);
+ Real ac;
+ BOOST_CHECK_EQUAL(-a , -8);
+ ac = a;
+ ac = ac - b;
+ BOOST_CHECK_EQUAL(ac , 8 - 64);
+ ac = a;
+ ac -= a + b;
+ BOOST_CHECK_EQUAL(ac , -64);
+ ac = a;
+ ac -= b - a;
+ BOOST_CHECK_EQUAL(ac , 16 - 64);
+ ac = -a;
+ BOOST_CHECK_EQUAL(ac , -8);
+ ac = a;
+ ac -= -a;
+ BOOST_CHECK_EQUAL(ac , 16);
+ ac = a;
+ ac += -a;
+ BOOST_CHECK_EQUAL(ac , 0);
+ ac = b;
+ ac /= -a;
+ BOOST_CHECK_EQUAL(ac , -8);
+ ac = a;
+ ac *= -a;
+ BOOST_CHECK_EQUAL(ac , -64);
+ ac = a + -b;
+ BOOST_CHECK_EQUAL(ac , 8 - 64);
+ ac = -a + b;
+ BOOST_CHECK_EQUAL(ac , -8+64);
+ ac = -a + -b;
+ BOOST_CHECK_EQUAL(ac , -72);
+ ac = a + - + -b; // lots of unary operators!!
+ BOOST_CHECK_EQUAL(ac , 72);
+ test_conditional(Real(-a), -a);
+}
+template <class Real>
+void test_signed_ops(const boost::mpl::false_&)
+{
+}
+
+template <class Real>
+void test()
+{
+#ifndef NO_MIXED_OPS
+ boost::multiprecision::is_number<Real> tag;
+ test_mixed<Real, unsigned char>(tag);
+ test_mixed<Real, signed char>(tag);
+ test_mixed<Real, char>(tag);
+ test_mixed<Real, short>(tag);
+ test_mixed<Real, unsigned short>(tag);
+ test_mixed<Real, int>(tag);
+ test_mixed<Real, unsigned int>(tag);
+ test_mixed<Real, long>(tag);
+ test_mixed<Real, unsigned long>(tag);
+#ifdef BOOST_HAS_LONG_LONG
+ test_mixed<Real, long long>(tag);
+ test_mixed<Real, unsigned long long>(tag);
+#endif
+ test_mixed<Real, float>(tag);
+ test_mixed<Real, double>(tag);
+ test_mixed<Real, long double>(tag);
+
+ typedef typename related_type<Real>::type related_type;
+ boost::mpl::bool_<boost::multiprecision::is_number<Real>::value && !boost::is_same<related_type, Real>::value> tag2;
+
+ test_mixed<Real, related_type>(tag2);
+
+#endif
+ //
+ // Integer only functions:
+ //
+ test_integer_ops<Real>(typename boost::multiprecision::number_category<Real>::type());
+ //
+ // Real number only functions:
+ //
+ test_float_ops<Real>(typename boost::multiprecision::number_category<Real>::type());
+ //
+ // Test basic arithmetic:
+ //
+ Real a(8);
+ Real b(64);
+ Real c(500);
+ Real d(1024);
+ BOOST_CHECK_EQUAL(a + b , 72);
+ a += b;
+ BOOST_CHECK_EQUAL(a , 72);
+ BOOST_CHECK_EQUAL(a - b , 8);
+ a -= b;
+ BOOST_CHECK_EQUAL(a , 8);
+ BOOST_CHECK_EQUAL(a * b , 8*64L);
+ a *= b;
+ BOOST_CHECK_EQUAL(a , 8*64L);
+ BOOST_CHECK_EQUAL(a / b , 8);
+ a /= b;
+ BOOST_CHECK_EQUAL(a , 8);
+ Real ac(a);
+ BOOST_CHECK_EQUAL(ac , a);
+ ac = a * c;
+ BOOST_CHECK_EQUAL(ac , 8*500L);
+ ac = 8*500L;
+ ac = ac + b + c;
+ BOOST_CHECK_EQUAL(ac , 8*500L+64+500);
+ ac = a;
+ ac = b + c + ac;
+ BOOST_CHECK_EQUAL(ac , 8+64+500);
+ ac = ac - b + c;
+ BOOST_CHECK_EQUAL(ac , 8+64+500-64+500);
+ ac = a;
+ ac = b + c - ac;
+ BOOST_CHECK_EQUAL(ac , -8+64+500);
+ ac = a;
+ ac = ac * b;
+ BOOST_CHECK_EQUAL(ac , 8*64);
+ ac = a;
+ ac *= b * ac;
+ BOOST_CHECK_EQUAL(ac , 8*8*64);
+ ac = b;
+ ac = ac / a;
+ BOOST_CHECK_EQUAL(ac , 64/8);
+ ac = b;
+ ac /= ac / a;
+ BOOST_CHECK_EQUAL(ac , 64 / (64/8));
+ ac = a;
+ ac = b + ac * a;
+ BOOST_CHECK_EQUAL(ac , 64 * 2);
+ ac = a;
+ ac = b - ac * a;
+ BOOST_CHECK_EQUAL(ac , 0);
+ ac = a;
+ ac = b * (ac + a);
+ BOOST_CHECK_EQUAL(ac , 64 * (16));
+ ac = a;
+ ac = b / (ac * 1);
+ BOOST_CHECK_EQUAL(ac , 64 / 8);
+ ac = a;
+ ac = ac + b;
+ BOOST_CHECK_EQUAL(ac , 8 + 64);
+ ac = a;
+ ac = a + ac;
+ BOOST_CHECK_EQUAL(ac , 16);
+ ac = a;
+ ac = a - ac;
+ BOOST_CHECK_EQUAL(ac , 0);
+ ac = a;
+ ac += a + b;
+ BOOST_CHECK_EQUAL(ac , 80);
+ ac = a;
+ ac += b + a;
+ BOOST_CHECK_EQUAL(ac , 80);
+ ac = +a;
+ BOOST_CHECK_EQUAL(ac , 8);
+ ac = 8;
+ ac = a * ac;
+ BOOST_CHECK_EQUAL(ac , 8*8);
+ ac = a;
+ ac = a;
+ ac += +a;
+ BOOST_CHECK_EQUAL(ac , 16);
+ ac = a;
+ ac += b - a;
+ BOOST_CHECK_EQUAL(ac , 8 + 64-8);
+ ac = a;
+ ac += b*c;
+ BOOST_CHECK_EQUAL(ac , 8 + 64 * 500);
+ ac = a;
+ ac = a;
+ ac -= +a;
+ BOOST_CHECK_EQUAL(ac , 0);
+ ac = a;
+ if(std::numeric_limits<Real>::is_signed || is_twos_complement_integer<Real>::value)
+ {
+ ac = a;
+ ac -= c - b;
+ BOOST_CHECK_EQUAL(ac , 8 - (500-64));
+ ac = a;
+ ac -= b*c;
+ BOOST_CHECK_EQUAL(ac , 8 - 500*64);
+ }
+ ac = a;
+ ac += ac * b;
+ BOOST_CHECK_EQUAL(ac , 8 + 8 * 64);
+ if(std::numeric_limits<Real>::is_signed || is_twos_complement_integer<Real>::value)
+ {
+ ac = a;
+ ac -= ac * b;
+ BOOST_CHECK_EQUAL(ac , 8 - 8 * 64);
+ }
+ ac = a * 8;
+ ac *= +a;
+ BOOST_CHECK_EQUAL(ac , 64 * 8);
+ ac = a;
+ ac *= b * c;
+ BOOST_CHECK_EQUAL(ac , 8 * 64 * 500);
+ ac = a;
+ ac *= b / a;
+ BOOST_CHECK_EQUAL(ac , 8 * 64 / 8);
+ ac = a;
+ ac *= b + c;
+ BOOST_CHECK_EQUAL(ac , 8 * (64 + 500));
+ ac = b;
+ ac /= +a;
+ BOOST_CHECK_EQUAL(ac , 8);
+ ac = b;
+ ac /= b / a;
+ BOOST_CHECK_EQUAL(ac , 64 / (64/8));
+ ac = b;
+ ac /= a + Real(0);
+ BOOST_CHECK_EQUAL(ac , 8);
+ //
+ // simple tests with immediate values, these calls can be optimised in many backends:
+ //
+ ac = a + b;
+ BOOST_CHECK_EQUAL(ac , 72);
+ ac = a + +b;
+ BOOST_CHECK_EQUAL(ac , 72);
+ ac = +a + b;
+ BOOST_CHECK_EQUAL(ac , 72);
+ ac = +a + +b;
+ BOOST_CHECK_EQUAL(ac , 72);
+ ac = a;
+ ac = b / ac;
+ BOOST_CHECK_EQUAL(ac , b / a);
+ //
+ // Comparisons:
+ //
+ BOOST_CHECK_EQUAL((a == b) , false);
+ BOOST_CHECK_EQUAL((a != b) , true);
+ BOOST_CHECK_EQUAL((a <= b) , true);
+ BOOST_CHECK_EQUAL((a < b) , true);
+ BOOST_CHECK_EQUAL((a >= b) , false);
+ BOOST_CHECK_EQUAL((a > b) , false);
+
+ BOOST_CHECK_EQUAL((a+b == b) , false);
+ BOOST_CHECK_EQUAL((a+b != b) , true);
+ BOOST_CHECK_EQUAL((a+b >= b) , true);
+ BOOST_CHECK_EQUAL((a+b > b) , true);
+ BOOST_CHECK_EQUAL((a+b <= b) , false);
+ BOOST_CHECK_EQUAL((a+b < b) , false);
+
+ BOOST_CHECK_EQUAL((a == b+a) , false);
+ BOOST_CHECK_EQUAL((a != b+a) , true);
+ BOOST_CHECK_EQUAL((a <= b+a) , true);
+ BOOST_CHECK_EQUAL((a < b+a) , true);
+ BOOST_CHECK_EQUAL((a >= b+a) , false);
+ BOOST_CHECK_EQUAL((a > b+a) , false);
+
+ BOOST_CHECK_EQUAL((a+b == b+a) , true);
+ BOOST_CHECK_EQUAL((a+b != b+a) , false);
+ BOOST_CHECK_EQUAL((a+b <= b+a) , true);
+ BOOST_CHECK_EQUAL((a+b < b+a) , false);
+ BOOST_CHECK_EQUAL((a+b >= b+a) , true);
+ BOOST_CHECK_EQUAL((a+b > b+a) , false);
+
+ BOOST_CHECK_EQUAL((8 == b+a) , false);
+ BOOST_CHECK_EQUAL((8 != b+a) , true);
+ BOOST_CHECK_EQUAL((8 <= b+a) , true);
+ BOOST_CHECK_EQUAL((8 < b+a) , true);
+ BOOST_CHECK_EQUAL((8 >= b+a) , false);
+ BOOST_CHECK_EQUAL((8 > b+a) , false);
+ BOOST_CHECK_EQUAL((800 == b+a) , false);
+ BOOST_CHECK_EQUAL((800 != b+a) , true);
+ BOOST_CHECK_EQUAL((800 >= b+a) , true);
+ BOOST_CHECK_EQUAL((800 > b+a) , true);
+ BOOST_CHECK_EQUAL((800 <= b+a) , false);
+ BOOST_CHECK_EQUAL((800 < b+a) , false);
+ BOOST_CHECK_EQUAL((72 == b+a) , true);
+ BOOST_CHECK_EQUAL((72 != b+a) , false);
+ BOOST_CHECK_EQUAL((72 <= b+a) , true);
+ BOOST_CHECK_EQUAL((72 < b+a) , false);
+ BOOST_CHECK_EQUAL((72 >= b+a) , true);
+ BOOST_CHECK_EQUAL((72 > b+a) , false);
+
+ test_members(a);
+ //
+ // Use in Boolean context:
+ //
+ a = 0;
+ if(a)
+ {
+ BOOST_ERROR("Unexpected non-zero result");
+ }
+ if(!a){}
+ else
+ {
+ BOOST_ERROR("Unexpected zero result");
+ }
+ b = 2;
+ if(!b)
+ {
+ BOOST_ERROR("Unexpected zero result");
+ }
+ if(b){}
+ else
+ {
+ BOOST_ERROR("Unexpected non-zero result");
+ }
+ if(a && b)
+ {
+ BOOST_ERROR("Unexpected zero result");
+ }
+ if(!(a || b))
+ {
+ BOOST_ERROR("Unexpected zero result");
+ }
+ if(a + b){}
+ else
+ {
+ BOOST_ERROR("Unexpected zero result");
+ }
+ if(b - 2)
+ {
+ BOOST_ERROR("Unexpected non-zero result");
+ }
+ //
+ // Test iostreams:
+ //
+ std::stringstream ss;
+ a = 20;
+ b = 2;
+ ss << a;
+ ss >> c;
+ BOOST_CHECK_EQUAL(a , c);
+ ss.clear();
+ ss << a + b;
+ ss >> c;
+ BOOST_CHECK_EQUAL(c , 22);
+ BOOST_CHECK_EQUAL(c , a + b);
+ //
+ // More cases for complete code coverage:
+ //
+ a = 20;
+ b = 30;
+ swap(a, b);
+ BOOST_CHECK_EQUAL(a , 30);
+ BOOST_CHECK_EQUAL(b , 20);
+ a = 20;
+ b = 30;
+ std::swap(a, b);
+ BOOST_CHECK_EQUAL(a , 30);
+ BOOST_CHECK_EQUAL(b , 20);
+ a = 20;
+ b = 30;
+ a = a + b * 2;
+ BOOST_CHECK_EQUAL(a , 20 + 30 * 2);
+ a = 100;
+ a = a - b * 2;
+ BOOST_CHECK_EQUAL(a , 100 - 30 * 2);
+ a = 20;
+ a = a * (b + 2);
+ BOOST_CHECK_EQUAL(a , 20 * (32));
+ a = 20;
+ a = (b + 2) * a;
+ BOOST_CHECK_EQUAL(a , 20 * (32));
+ a = 90;
+ b = 2;
+ a = a / (b + 0);
+ BOOST_CHECK_EQUAL(a , 45);
+ a = 20;
+ b = 30;
+ c = (a * b) + 22;
+ BOOST_CHECK_EQUAL(c , 20 * 30 + 22);
+ c = 22 + (a * b);
+ BOOST_CHECK_EQUAL(c , 20 * 30 + 22);
+ c = 10;
+ ac = a + b * c;
+ BOOST_CHECK_EQUAL(ac , 20 + 30 * 10);
+ ac = b * c + a;
+ BOOST_CHECK_EQUAL(ac , 20 + 30 * 10);
+ a = a + b * c;
+ BOOST_CHECK_EQUAL(a , 20 + 30 * 10);
+ a = 20;
+ b = a + b * c;
+ BOOST_CHECK_EQUAL(b , 20 + 30 * 10);
+ b = 30;
+ c = a + b * c;
+ BOOST_CHECK_EQUAL(c , 20 + 30 * 10);
+
+ //
+ // Test conditionals:
+ //
+ a = 20;
+ test_conditional(a, +a);
+ test_conditional(a, (a + 0));
+
+ test_signed_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_ab_1.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_ab_1.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,19 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+# include "../performance/arithmetic_backend.hpp"
+
+#include "test_arithmetic.hpp"
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<double> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_ab_2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_ab_2.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,19 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+# include "../performance/arithmetic_backend.hpp"
+
+#include "test_arithmetic.hpp"
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<int> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_ab_3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_ab_3.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,19 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+# include "../performance/arithmetic_backend.hpp"
+
+#include "test_arithmetic.hpp"
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<unsigned int> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_backend_concept.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_backend_concept.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,19 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/concepts/mp_number_archetypes.hpp>
+
+#include "test_arithmetic.hpp"
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::concepts::number_backend_float_architype> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_1.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_1.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D/2> > type;
+};
+
+int main()
+{
+ test<boost::multiprecision::cpp_dec_float_50>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_2.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D/2> > type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100, long long>, boost::multiprecision::et_off> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_dec_float_3.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<D/2> > type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100, long long, std::allocator<void> >, boost::multiprecision::et_on> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_1.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_1.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::cpp_int>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_10.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_10.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::checked_cpp_rational>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_11.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_11.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<0, 0, boost::multiprecision::signed_magnitude, boost::multiprecision::checked>, boost::multiprecision::et_off> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_12.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_12.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<500, 500, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_13.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_13.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_14.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_14.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_15.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_15.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<31, 31, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_16.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_16.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_17.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_17.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::checked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_18.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_18.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<31, 31, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_2.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::int512_t >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_3.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::uint1024_t >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_4.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_4.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::checked_cpp_int>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_5.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_5.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::checked_int512_t >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_6.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_6.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::checked_uint1024_t >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_7.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_7.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::cpp_rational>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_8.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_8.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_9.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_9.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<500, 500, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_cpp_int_br.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_cpp_int_br.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_ {};
+
+template <>
+struct related_type<boost::multiprecision::cpp_int>
+{
+ typedef boost::multiprecision::int256_t type;
+};
+template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
+struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
+{
+ typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits/2, MaxBits/2, SignType, Checked, Allocator>, ET> type;
+};
+
+int main()
+{
+ test<boost::rational<boost::multiprecision::cpp_int> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpf.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpf.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/gmp.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::gmp_float<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::gmp_float<D/2> > type;
+};
+template <>
+struct related_type<boost::multiprecision::mpf_float >
+{
+ typedef boost::multiprecision::mpz_int type;
+};
+
+int main()
+{
+ boost::multiprecision::mpf_float::default_precision(1000);
+ BOOST_CHECK_EQUAL(boost::multiprecision::mpf_float::default_precision() , 1000);
+ test<boost::multiprecision::mpf_float>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpf_50.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpf_50.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,30 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/gmp.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::gmp_float<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::gmp_float<D/2> > type;
+};
+template <>
+struct related_type<boost::multiprecision::mpf_float >
+{
+ typedef boost::multiprecision::mpz_int type;
+};
+
+int main()
+{
+ test<boost::multiprecision::mpf_float_50>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpfr.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpfr.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/mpfr.hpp>
+#define TEST_MPFR
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D/2> > type;
+};
+
+int main()
+{
+ test<boost::multiprecision::mpfr_float>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpfr_50.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpfr_50.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,26 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/mpfr.hpp>
+#define TEST_MPFR
+#include "test_arithmetic.hpp"
+
+template <unsigned D>
+struct related_type<boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D> > >
+{
+ typedef boost::multiprecision::number< boost::multiprecision::mpfr_float_backend<D/2> > type;
+};
+
+int main()
+{
+ test<boost::multiprecision::mpfr_float_50>();
+ test<boost::multiprecision::static_mpfr_float_50>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpq.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpq.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/gmp.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <>
+struct related_type<boost::multiprecision::mpq_rational>
+{
+ typedef boost::multiprecision::mpz_int type;
+};
+
+int main()
+{
+ test<boost::multiprecision::mpq_rational>();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpz.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpz.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/gmp.hpp>
+#include <boost/multiprecision/rational_adapter.hpp>
+
+#include "test_arithmetic.hpp"
+
+int main()
+{
+ test<boost::multiprecision::mpz_int>();
+ test<boost::multiprecision::number<boost::multiprecision::rational_adapter<boost::multiprecision::gmp_int> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_mpz_br.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_mpz_br.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/gmp.hpp>
+
+#define NO_MIXED_OPS
+
+#include "test_arithmetic.hpp"
+#include <boost/rational.hpp>
+
+template <class T>
+struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_{};
+
+namespace boost{ namespace multiprecision{
+
+template<>
+struct number_category<rational<mpz_int> > : public mpl::int_<number_kind_rational> {};
+
+}}
+
+int main()
+{
+ test<boost::rational<boost::multiprecision::mpz_int> >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_tommath.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_tommath.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/tommath.hpp>
+
+#include "test_arithmetic.hpp"
+
+template <>
+struct is_twos_complement_integer<boost::multiprecision::tom_int> : public boost::mpl::false_ {};
+
+int main()
+{
+ test<boost::multiprecision::tom_int>();
+ test<boost::multiprecision::number<boost::multiprecision::rational_adapter<boost::multiprecision::tommath_int> > >();
+ return 0;
+}
+

Added: trunk/libs/multiprecision/test/test_arithmetic_tommath_br.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/multiprecision/test/test_arithmetic_tommath_br.cpp 2012-12-01 11:19:23 EST (Sat, 01 Dec 2012)
@@ -0,0 +1,32 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/tommath.hpp>
+
+#define NO_MIXED_OPS
+#include "test_arithmetic.hpp"
+
+#include <boost/rational.hpp>
+
+template <class T>
+struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_{};
+
+namespace boost{ namespace multiprecision{
+
+template<>
+struct number_category<rational<tom_int> > : public mpl::int_<number_kind_rational> {};
+
+}}
+
+int main()
+{
+ test<boost::rational<boost::multiprecision::tom_int> >();
+ return 0;
+}
+


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