|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77323 - in sandbox/big_number: boost/multiprecision boost/multiprecision/concepts boost/multiprecision/detail libs/multiprecision/doc libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-03-13 14:30:20
Author: johnmaddock
Date: 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
New Revision: 77323
URL: http://svn.boost.org/trac/boost/changeset/77323
Log:
Add support for disabling expression templates via a second template parameter to mp_number.
Begin to update docs to reflect new cpp_int code.
Text files modified:
sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp | 6
sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp | 6
sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp | 26 +-
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 26 +-
sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp | 6
sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 201 ++++++++++------
sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp | 468 ++++++++++++++++++++--------------------
sandbox/big_number/boost/multiprecision/fixed_int.hpp | 12
sandbox/big_number/boost/multiprecision/gmp.hpp | 28 +-
sandbox/big_number/boost/multiprecision/mp_number.hpp | 128 +++++-----
sandbox/big_number/boost/multiprecision/mpfr.hpp | 21 +
sandbox/big_number/boost/multiprecision/rational_adapter.hpp | 6
sandbox/big_number/boost/multiprecision/tommath.hpp | 6
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 195 ++++++++++++----
sandbox/big_number/libs/multiprecision/test/Jamfile.v2 | 49 ---
sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp | 8
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 2
sandbox/big_number/libs/multiprecision/test/test_int_io.cpp | 11
18 files changed, 678 insertions(+), 527 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp (original)
+++ sandbox/big_number/boost/multiprecision/arithmetic_backend.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -127,11 +127,11 @@
namespace std{
-template <class Arithmetic>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::arithmetic_backend<Arithmetic> > > : public std::numeric_limits<Arithmetic>
+template <class Arithmetic, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::arithmetic_backend<Arithmetic>, ExpressionTemplates > > : public std::numeric_limits<Arithmetic>
{
typedef std::numeric_limits<Arithmetic> base_type;
- typedef boost::multiprecision::mp_number<boost::multiprecision::arithmetic_backend<Arithmetic> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::arithmetic_backend<Arithmetic>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR number_type (min)() BOOST_MP_NOEXCEPT { return (base_type::min)(); }
BOOST_STATIC_CONSTEXPR number_type (max)() BOOST_MP_NOEXCEPT { return (base_type::max)(); }
Modified: sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp (original)
+++ sandbox/big_number/boost/multiprecision/concepts/mp_number_architypes.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -192,11 +192,11 @@
namespace std{
-template <>
-class numeric_limits<boost::multiprecision::concepts::mp_number_float_architype> : public std::numeric_limits<long double>
+template <bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::concepts::mp_number_backend_float_architype, ExpressionTemplates> > : public std::numeric_limits<long double>
{
typedef std::numeric_limits<long double> base_type;
- typedef boost::multiprecision::concepts::mp_number_float_architype number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::concepts::mp_number_backend_float_architype, ExpressionTemplates> number_type;
public:
static number_type (min)() BOOST_MP_NOEXCEPT { return (base_type::min)(); }
static number_type (max)() BOOST_MP_NOEXCEPT { return (base_type::max)(); }
Modified: sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_dec_float.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -2822,8 +2822,8 @@
namespace std
{
- template <unsigned Digits10>
- class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > >
+ template <unsigned Digits10, bool ExpressionTemplates>
+ class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> >
{
public:
static const bool is_specialized = true;
@@ -2850,15 +2850,15 @@
static const bool traps = false;
static const bool tinyness_before = false;
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > (min) (void) { return (boost::multiprecision::cpp_dec_float<Digits10>::min)(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > (max) (void) { return (boost::multiprecision::cpp_dec_float<Digits10>::max)(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > lowest (void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > epsilon (void) { return boost::multiprecision::cpp_dec_float<Digits10>::eps(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > round_error (void) { return 0.5L; }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > infinity (void) { return boost::multiprecision::cpp_dec_float<Digits10>::inf(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > quiet_NaN (void) { return boost::multiprecision::cpp_dec_float<Digits10>::nan(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > signaling_NaN(void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
- static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> > denorm_min (void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> (min) (void) { return (boost::multiprecision::cpp_dec_float<Digits10>::min)(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> (max) (void) { return (boost::multiprecision::cpp_dec_float<Digits10>::max)(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> lowest (void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> epsilon (void) { return boost::multiprecision::cpp_dec_float<Digits10>::eps(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> round_error (void) { return 0.5L; }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> infinity (void) { return boost::multiprecision::cpp_dec_float<Digits10>::inf(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> quiet_NaN (void) { return boost::multiprecision::cpp_dec_float<Digits10>::nan(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> signaling_NaN(void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
+ static const boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates> denorm_min (void) { return boost::multiprecision::cpp_dec_float<Digits10>::zero(); }
};
}
@@ -2866,8 +2866,8 @@
namespace policies{
-template <unsigned Digits10, class Policy>
-struct precision< boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10> >, Policy>
+template <unsigned Digits10, class Policy, bool ExpressionTemplates>
+struct precision< boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<Digits10>, ExpressionTemplates>, Policy>
{
typedef typename Policy::precision_type precision_type;
typedef digits2<((Digits10 + 1) * 1000L) / 301L> digits_2;
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -2146,10 +2146,10 @@
namespace std{
-template <unsigned MinBits, bool Signed, class Allocator>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, Signed, Allocator> > >
+template <unsigned MinBits, bool Signed, class Allocator, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, Signed, Allocator>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, Signed, Allocator> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, Signed, Allocator>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
@@ -2196,10 +2196,10 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template <unsigned MinBits>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void> > >
+template <unsigned MinBits, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void>, ExpressionTemplates> number_type;
struct inititializer
{
@@ -2273,13 +2273,13 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template <unsigned MinBits>
-const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void> > >::inititializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void> > >::init;
+template <unsigned MinBits, bool ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void>, ExpressionTemplates> >::inititializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, true, void>, ExpressionTemplates> >::init;
-template <unsigned MinBits>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void> > >
+template <unsigned MinBits, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void>, ExpressionTemplates> number_type;
struct inititializer
{
@@ -2352,8 +2352,8 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template <unsigned MinBits>
-const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void> > >::inititializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void> > >::init;
+template <unsigned MinBits, bool ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void>, ExpressionTemplates> >::inititializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<MinBits, false, void>, ExpressionTemplates> >::init;
}
Modified: sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/big_lanczos.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -16,10 +16,10 @@
template <class T, class Policy>
struct lanczos;
-template<class Backend, class Policy>
-struct lanczos<multiprecision::mp_number<Backend>, Policy>
+template<class Backend, bool ExpressionTemplates, class Policy>
+struct lanczos<multiprecision::mp_number<Backend, ExpressionTemplates>, Policy>
{
- typedef typename boost::math::policies::precision<multiprecision::mp_number<Backend>, Policy>::type precision_type;
+ typedef typename boost::math::policies::precision<multiprecision::mp_number<Backend, ExpressionTemplates>, Policy>::type precision_type;
typedef typename mpl::if_c<
precision_type::value <= 73,
lanczos13UDT,
Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -531,16 +531,13 @@
}
-template <class Backend>
-class mp_number;
-
} // namespace multiprecision
namespace math{
//
// Default versions of floating point classification routines:
//
-template <class Backend>
-inline int fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend>& arg)
+template <class Backend, bool ExpressionTemplates>
+inline int fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend, ExpressionTemplates>& arg)
{
using multiprecision::default_ops::eval_fpclassify;
return eval_fpclassify(arg.backend());
@@ -551,8 +548,8 @@
typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type value_type;
return fpclassify(value_type(arg));
}
-template <class Backend>
-inline bool isfinite BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend>& arg)
+template <class Backend, bool ExpressionTemplates>
+inline bool isfinite BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend, ExpressionTemplates>& arg)
{
int v = fpclassify(arg);
return (v != FP_INFINITE) && (v != FP_NAN);
@@ -563,8 +560,8 @@
typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type value_type;
return isfinite(value_type(arg));
}
-template <class Backend>
-inline bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend>& arg)
+template <class Backend, bool ExpressionTemplates>
+inline bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend, ExpressionTemplates>& arg)
{
return fpclassify(arg) == FP_NAN;
}
@@ -574,8 +571,8 @@
typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type value_type;
return isnan(value_type(arg));
}
-template <class Backend>
-inline bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend>& arg)
+template <class Backend, bool ExpressionTemplates>
+inline bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend, ExpressionTemplates>& arg)
{
return fpclassify(arg) == FP_INFINITE;
}
@@ -585,8 +582,8 @@
typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type value_type;
return isinf(value_type(arg));
}
-template <class Backend>
-inline bool isnormal BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend>& arg)
+template <class Backend, bool ExpressionTemplates>
+inline bool isnormal BOOST_PREVENT_MACRO_SUBSTITUTION(const multiprecision::mp_number<Backend, ExpressionTemplates>& arg)
{
return fpclassify(arg) == FP_NORMAL;
}
@@ -607,11 +604,11 @@
return trunc(number_type(v), pol);
}
-template <class Backend, class Policy>
-inline mp_number<Backend> trunc(const mp_number<Backend>& v, const Policy& pol)
+template <class Backend, bool ExpressionTemplates, class Policy>
+inline mp_number<Backend, ExpressionTemplates> trunc(const mp_number<Backend, ExpressionTemplates>& v, const Policy& pol)
{
using default_ops::eval_trunc;
- mp_number<Backend> result;
+ mp_number<Backend, ExpressionTemplates> result;
eval_trunc(result.backend(), v.backend());
return result;
}
@@ -630,16 +627,16 @@
{
return itrunc(v, boost::math::policies::policy<>());
}
-template <class Backend, class Policy>
-inline int itrunc(const mp_number<Backend>& v, const Policy& pol)
+template <class Backend, bool ExpressionTemplates, class Policy>
+inline int itrunc(const mp_number<Backend, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<Backend> r = trunc(v, pol);
+ mp_number<Backend, ExpressionTemplates> r = trunc(v, pol);
if((r > (std::numeric_limits<int>::max)()) || r < (std::numeric_limits<int>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::itrunc<%1%>(%1%)", 0, v, 0, pol).template convert_to<int>();
return r.template convert_to<int>();
}
-template <class Backend>
-inline int itrunc(const mp_number<Backend>& v)
+template <class Backend, bool ExpressionTemplates>
+inline int itrunc(const mp_number<Backend, ExpressionTemplates>& v)
{
return itrunc(v, boost::math::policies::policy<>());
}
@@ -657,16 +654,16 @@
{
return ltrunc(v, boost::math::policies::policy<>());
}
-template <class T, class Policy>
-inline long ltrunc(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline long ltrunc(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<T> r = trunc(v, pol);
+ mp_number<T, ExpressionTemplates> r = trunc(v, pol);
if((r > (std::numeric_limits<long>::max)()) || r < (std::numeric_limits<long>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::ltrunc<%1%>(%1%)", 0, v, 0L, pol).template convert_to<long>();
return r.template convert_to<long>();
}
-template <class T>
-inline long ltrunc(const mp_number<T>& v)
+template <class T, bool ExpressionTemplates>
+inline long ltrunc(const mp_number<T, ExpressionTemplates>& v)
{
return ltrunc(v, boost::math::policies::policy<>());
}
@@ -685,16 +682,16 @@
{
return lltrunc(v, boost::math::policies::policy<>());
}
-template <class T, class Policy>
-inline long long lltrunc(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline long long lltrunc(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<T> r = trunc(v, pol);
+ mp_number<T, ExpressionTemplates> r = trunc(v, pol);
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::lltrunc<%1%>(%1%)", 0, v, 0LL, pol).template convert_to<long long>();
return r.template convert_to<long long>();
}
-template <class T>
-inline long long lltrunc(const mp_number<T>& v)
+template <class T, bool ExpressionTemplates>
+inline long long lltrunc(const mp_number<T, ExpressionTemplates>& v)
{
return lltrunc(v, boost::math::policies::policy<>());
}
@@ -705,11 +702,11 @@
typedef typename detail::mp_exp<tag, A1, A2, A3>::result_type number_type;
return round(static_cast<number_type>(v), pol);
}
-template <class T, class Policy>
-inline mp_number<T> round(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline mp_number<T, ExpressionTemplates> round(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
using default_ops::eval_round;
- mp_number<T> result;
+ mp_number<T, ExpressionTemplates> result;
eval_round(result.backend(), v.backend());
return result;
}
@@ -728,16 +725,16 @@
{
return iround(v, boost::math::policies::policy<>());
}
-template <class T, class Policy>
-inline int iround(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline int iround(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<T> r = round(v, pol);
+ mp_number<T, ExpressionTemplates> r = round(v, pol);
if((r > (std::numeric_limits<int>::max)()) || r < (std::numeric_limits<int>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::iround<%1%>(%1%)", 0, v, 0, pol).template convert_to<int>();
return r.template convert_to<int>();
}
-template <class T>
-inline int iround(const mp_number<T>& v)
+template <class T, bool ExpressionTemplates>
+inline int iround(const mp_number<T, ExpressionTemplates>& v)
{
return iround(v, boost::math::policies::policy<>());
}
@@ -755,16 +752,16 @@
{
return lround(v, boost::math::policies::policy<>());
}
-template <class T, class Policy>
-inline long lround(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline long lround(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<T> r = round(v, pol);
+ mp_number<T, ExpressionTemplates> r = round(v, pol);
if((r > (std::numeric_limits<long>::max)()) || r < (std::numeric_limits<long>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::lround<%1%>(%1%)", 0, v, 0L, pol).template convert_to<long>();
return r.template convert_to<long>();
}
-template <class T>
-inline long lround(const mp_number<T>& v)
+template <class T, bool ExpressionTemplates>
+inline long lround(const mp_number<T, ExpressionTemplates>& v)
{
return lround(v, boost::math::policies::policy<>());
}
@@ -783,16 +780,16 @@
{
return llround(v, boost::math::policies::policy<>());
}
-template <class T, class Policy>
-inline long long llround(const mp_number<T>& v, const Policy& pol)
+template <class T, bool ExpressionTemplates, class Policy>
+inline long long llround(const mp_number<T, ExpressionTemplates>& v, const Policy& pol)
{
- mp_number<T> r = round(v, pol);
+ mp_number<T, ExpressionTemplates> r = round(v, pol);
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !boost::math::isfinite(v))
return boost::math::policies::raise_rounding_error("boost::multiprecision::iround<%1%>(%1%)", 0, v, 0LL, pol).template convert_to<long long>();
return r.template convert_to<long long>();
}
-template <class T>
-inline long long llround(const mp_number<T>& v)
+template <class T, bool ExpressionTemplates>
+inline long long llround(const mp_number<T, ExpressionTemplates>& v)
{
return llround(v, boost::math::policies::policy<>());
}
@@ -813,7 +810,7 @@
}\
\
template <class tag, class A1, class A2, class A3> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type> \
, detail::mp_exp<tag, A1, A2, A3> \
@@ -830,7 +827,7 @@
);\
}\
template <class Backend> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, mp_number<Backend> \
@@ -845,6 +842,15 @@
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg \
);\
+}\
+template <class Backend> \
+inline mp_number<Backend, false> \
+func(const mp_number<Backend, false>& arg)\
+{\
+ mp_number<Backend, false> result;\
+ using default_ops::BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result.backend(), arg.backend());\
+ return result;\
}
#define BINARY_OP_FUNCTOR(func)\
@@ -873,7 +879,7 @@
\
}\
template <class Backend> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, mp_number<Backend> \
@@ -893,7 +899,7 @@
);\
}\
template <class Backend, class tag, class A1, class A2, class A3> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, mp_number<Backend> \
@@ -913,7 +919,7 @@
);\
}\
template <class tag, class A1, class A2, class A3, class Backend> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, detail::mp_exp<tag, A1, A2, A3> \
@@ -933,7 +939,7 @@
);\
}\
template <class tag, class A1, class A2, class A3, class tagb, class A1b, class A2b, class A3b> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type> \
, detail::mp_exp<tag, A1, A2, A3> \
@@ -953,7 +959,7 @@
);\
}\
template <class Backend, class Arithmetic> \
-typename enable_if<\
+inline typename enable_if<\
is_arithmetic<Arithmetic>,\
detail::mp_exp<\
detail::function\
@@ -976,7 +982,7 @@
);\
}\
template <class tag, class A1, class A2, class A3, class Arithmetic> \
-typename enable_if<\
+inline typename enable_if<\
is_arithmetic<Arithmetic>,\
detail::mp_exp<\
detail::function\
@@ -999,13 +1005,13 @@
);\
}\
template <class Backend, class Arithmetic> \
-typename enable_if<\
+inline typename enable_if<\
is_arithmetic<Arithmetic>,\
detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, Arithmetic \
- , mp_number<Backend>\
+ , mp_number<Backend> \
> \
>::type \
func(const Arithmetic& arg, const mp_number<Backend>& a)\
@@ -1014,7 +1020,7 @@
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, Arithmetic \
- , mp_number<Backend>\
+ , mp_number<Backend> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg,\
@@ -1022,13 +1028,13 @@
);\
}\
template <class tag, class A1, class A2, class A3, class Arithmetic> \
-typename enable_if<\
+inline typename enable_if<\
is_arithmetic<Arithmetic>,\
detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type> \
, Arithmetic \
- , detail::mp_exp<tag, A1, A2, A3>\
+ , detail::mp_exp<tag, A1, A2, A3> \
> \
>::type \
func(const Arithmetic& arg, const detail::mp_exp<tag, A1, A2, A3>& a)\
@@ -1037,13 +1043,48 @@
detail::function\
, detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type> \
, Arithmetic \
- , detail::mp_exp<tag, A1, A2, A3>\
+ , detail::mp_exp<tag, A1, A2, A3> \
>(\
detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type>() \
, arg,\
a\
);\
}\
+template <class Backend> \
+inline mp_number<Backend, false> \
+func(const mp_number<Backend, false>& arg, const mp_number<Backend, false>& a)\
+{\
+ mp_number<Backend, false> result;\
+ using default_ops:: BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result.backend(), arg.backend(), a.backend());\
+ return result;\
+}\
+template <class Backend, class Arithmetic> \
+inline typename enable_if<\
+ is_arithmetic<Arithmetic>,\
+ mp_number<Backend, false> \
+>::type \
+func(const mp_number<Backend, false>& arg, const Arithmetic& a)\
+{\
+ typedef typename detail::canonical<Arithmetic, Backend>::type canonical_type;\
+ mp_number<Backend, false> result;\
+ using default_ops:: BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result.backend(), arg.backend(), static_cast<canonical_type>(a));\
+ return result;\
+}\
+template <class Backend, class Arithmetic> \
+inline typename enable_if<\
+ is_arithmetic<Arithmetic>,\
+ mp_number<Backend, false> \
+>::type \
+func(const Arithmetic& a, const mp_number<Backend, false>& arg)\
+{\
+ typedef typename detail::canonical<Arithmetic, Backend>::type canonical_type;\
+ mp_number<Backend, false> result;\
+ using default_ops:: BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result.backend(), static_cast<canonical_type>(a), arg.backend());\
+ return result;\
+}\
#define HETERO_BINARY_OP_FUNCTOR(func, Arg2)\
@@ -1061,7 +1102,7 @@
}\
\
template <class tag, class A1, class A2, class A3> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<typename detail::backend_type<detail::mp_exp<tag, A1, A2, A3> >::type> \
, detail::mp_exp<tag, A1, A2, A3> \
@@ -1080,7 +1121,7 @@
);\
}\
template <class Backend> \
-detail::mp_exp<\
+inline detail::mp_exp<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, mp_number<Backend> \
@@ -1099,6 +1140,15 @@
a\
);\
}\
+template <class Backend> \
+inline mp_number<Backend, false> \
+func(const mp_number<Backend, false>& arg, Arg2 const& a)\
+{\
+ mp_number<Backend, false> result;\
+ using default_ops:: BOOST_JOIN(eval_,func);\
+ BOOST_JOIN(eval_,func)(result.backend(), arg.backend(), a);\
+ return result;\
+}\
UNARY_OP_FUNCTOR(abs)
UNARY_OP_FUNCTOR(fabs)
@@ -1146,26 +1196,26 @@
template <class T> T sinc_pi_imp(T);
template <class T> T sinhc_pi_imp(T);
}
-template <class Backend>
-inline multiprecision::mp_number<Backend> sinc_pi(const multiprecision::mp_number<Backend>& x)
+template <class Backend, bool ExpressionTemplates>
+inline multiprecision::mp_number<Backend, ExpressionTemplates> sinc_pi(const multiprecision::mp_number<Backend, ExpressionTemplates>& x)
{
return detail::sinc_pi_imp(x);
}
-template <class Backend, class Policy>
-inline multiprecision::mp_number<Backend> sinc_pi(const multiprecision::mp_number<Backend>& x, const Policy&)
+template <class Backend, bool ExpressionTemplates, class Policy>
+inline multiprecision::mp_number<Backend, ExpressionTemplates> sinc_pi(const multiprecision::mp_number<Backend, ExpressionTemplates>& x, const Policy&)
{
return detail::sinc_pi_imp(x);
}
-template <class Backend>
-inline multiprecision::mp_number<Backend> sinhc_pi(const multiprecision::mp_number<Backend>& x)
+template <class Backend, bool ExpressionTemplates>
+inline multiprecision::mp_number<Backend, ExpressionTemplates> sinhc_pi(const multiprecision::mp_number<Backend, ExpressionTemplates>& x)
{
return detail::sinhc_pi_imp(x);
}
-template <class Backend, class Policy>
-inline multiprecision::mp_number<Backend> sinhc_pi(const multiprecision::mp_number<Backend>& x, const Policy&)
+template <class Backend, bool ExpressionTemplates, class Policy>
+inline multiprecision::mp_number<Backend, ExpressionTemplates> sinhc_pi(const multiprecision::mp_number<Backend, ExpressionTemplates>& x, const Policy&)
{
return boost::math::sinhc_pi(x);
}
@@ -1173,5 +1223,10 @@
} // namespace math
} // namespace boost
+//
+// This has to come last of all:
+//
+#include <boost/multiprecision/detail/no_et_ops.hpp>
+
#endif
Modified: sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/mp_number_base.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -19,7 +19,7 @@
namespace boost{ namespace multiprecision{
-template <class Backend>
+template <class Backend, bool ExpressionTemplates = true>
class mp_number;
namespace detail{
@@ -138,8 +138,8 @@
template <class T>
struct backend_type;
-template <class T>
-struct backend_type<mp_number<T> >
+template <class T, bool ExpressionTemplates>
+struct backend_type<mp_number<T, ExpressionTemplates> >
{
typedef T type;
};
@@ -153,8 +153,8 @@
template <class T>
struct is_mp_number : public mpl::false_{};
-template <class T>
-struct is_mp_number<boost::multiprecision::mp_number<T> > : public mpl::true_{};
+template <class T, bool ExpressionTemplates>
+struct is_mp_number<boost::multiprecision::mp_number<T, ExpressionTemplates> > : public mpl::true_{};
template <class T>
struct is_mp_number_exp : public mpl::false_{};
template <class Tag, class Arg1, class Arg2, class Arg3>
@@ -163,22 +163,22 @@
template <class T1, class T2>
struct combine_expression;
-template <class T1, class T2>
-struct combine_expression<mp_number<T1>, T2>
+template <class T1, bool ExpressionTemplates, class T2>
+struct combine_expression<mp_number<T1, ExpressionTemplates>, T2>
{
- typedef mp_number<T1> type;
+ typedef mp_number<T1, ExpressionTemplates> type;
};
-template <class T1, class T2>
-struct combine_expression<T1, mp_number<T2> >
+template <class T1, class T2, bool ExpressionTemplates>
+struct combine_expression<T1, mp_number<T2, ExpressionTemplates> >
{
- typedef mp_number<T2> type;
+ typedef mp_number<T2, ExpressionTemplates> type;
};
-template <class T>
-struct combine_expression<mp_number<T>, mp_number<T> >
+template <class T, bool ExpressionTemplates>
+struct combine_expression<mp_number<T, ExpressionTemplates>, mp_number<T, ExpressionTemplates> >
{
- typedef mp_number<T> type;
+ typedef mp_number<T, ExpressionTemplates> type;
};
template <class T>
@@ -500,50 +500,50 @@
//
// Unary operators first:
//
-template <class B>
-inline const mp_number<B>& operator + (const mp_number<B>& v) { return v; }
+template <class B, bool ExpressionTemplates>
+inline const mp_number<B, ExpressionTemplates>& operator + (const mp_number<B, ExpressionTemplates>& v) { return v; }
template <class tag, class Arg1, class Arg2, class Arg3>
inline const detail::mp_exp<tag, Arg1, Arg2, Arg3>& operator + (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& v) { return v; }
template <class B>
-inline detail::mp_exp<detail::negate, mp_number<B> > operator - (const mp_number<B>& v) { return detail::mp_exp<detail::negate, mp_number<B> >(v); }
+inline detail::mp_exp<detail::negate, mp_number<B, true> > operator - (const mp_number<B, true>& v) { return detail::mp_exp<detail::negate, mp_number<B, true> >(v); }
template <class tag, class Arg1, class Arg2, class Arg3>
inline detail::mp_exp<detail::negate, detail::mp_exp<tag, Arg1, Arg2, Arg3> > operator - (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& v) { return detail::mp_exp<detail::negate, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(v); }
template <class B>
-inline detail::mp_exp<detail::complement_immediates, mp_number<B> > operator ~ (const mp_number<B>& v) { return detail::mp_exp<detail::complement_immediates, mp_number<B> >(v); }
+inline detail::mp_exp<detail::complement_immediates, mp_number<B, true> > operator ~ (const mp_number<B, true>& v) { return detail::mp_exp<detail::complement_immediates, mp_number<B, true> >(v); }
template <class tag, class Arg1, class Arg2, class Arg3>
inline detail::mp_exp<detail::bitwise_complement, detail::mp_exp<tag, Arg1, Arg2, Arg3> > operator ~ (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& v) { return detail::mp_exp<detail::bitwise_complement, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(v); }
//
// Then addition:
//
template <class B>
-inline detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> >
- operator + (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator + (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, mp_number<B>, V > >::type
- operator + (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, mp_number<B, true>, V > >::type
+ operator + (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::add_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::add_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, V, mp_number<B> > >::type
- operator + (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, V, mp_number<B, true> > >::type
+ operator + (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::add_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::add_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::plus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator + (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::plus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator + (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::plus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::plus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::plus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator + (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::plus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator + (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::plus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::plus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::plus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -567,73 +567,73 @@
// Repeat operator for negated arguments: propagate the negation to the top level to avoid temporaries:
//
template <class B, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::minus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
- operator + (const mp_number<B>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::minus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
+ operator + (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::minus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref());
+ return detail::mp_exp<detail::minus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref());
}
template <class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::minus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
- operator + (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::minus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
+ operator + (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::minus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref());
+ return detail::mp_exp<detail::minus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref());
}
template <class B>
-inline detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >
- operator + (const mp_number<B>& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator + (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >(a, b.left_ref());
+ return detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >(a, b.left_ref());
}
template <class B>
-inline detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >
- operator + (const detail::mp_exp<detail::negate, mp_number<B> >& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator + (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >(b, a.left_ref());
+ return detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >(b, a.left_ref());
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B> > >::type
- operator + (const detail::mp_exp<detail::negate, mp_number<B> >& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B, true> > >::type
+ operator + (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const V& b)
{
- return detail::mp_exp<detail::subtract_immediates, V, mp_number<B> >(b, a.left_ref());
+ return detail::mp_exp<detail::subtract_immediates, V, mp_number<B, true> >(b, a.left_ref());
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B> > >::type
- operator + (const V& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B, true> > >::type
+ operator + (const V& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >(a, b.left_ref());
+ return detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >(a, b.left_ref());
}
//
// Subtraction:
//
template <class B>
-inline detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >
- operator - (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator - (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::subtract_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, mp_number<B>, V > >::type
- operator - (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, V > >::type
+ operator - (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::subtract_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::subtract_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B> > >::type
- operator - (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::subtract_immediates, V, mp_number<B, true> > >::type
+ operator - (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::subtract_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::subtract_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::minus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator - (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::minus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator - (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::minus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::minus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::minus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator - (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::minus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator - (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::minus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::minus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::minus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -657,75 +657,75 @@
// Repeat operator for negated arguments: propagate the negation to the top level to avoid temporaries:
//
template <class B, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::plus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
- operator - (const mp_number<B>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::plus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >
+ operator - (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::plus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref());
+ return detail::mp_exp<detail::plus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref());
}
template <class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::plus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
- operator - (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::plus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
+ operator - (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::plus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
- detail::mp_exp<detail::plus, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::plus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
+ detail::mp_exp<detail::plus, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref()));
}
template <class B>
-inline detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> >
- operator - (const mp_number<B>& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator - (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> >(a, b.left_ref());
+ return detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> >(a, b.left_ref());
}
template <class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> > >
- operator - (const detail::mp_exp<detail::negate, mp_number<B> >& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> > >
+ operator - (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> > >(
- detail::mp_exp<detail::add_immediates, mp_number<B>, mp_number<B> >(b, a.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> > >(
+ detail::mp_exp<detail::add_immediates, mp_number<B, true>, mp_number<B, true> >(b, a.left_ref()));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B>, V > > >::type
- operator - (const detail::mp_exp<detail::negate, mp_number<B> >& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B, true>, V > > >::type
+ operator - (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const V& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B>, V > >(detail::mp_exp<detail::add_immediates, mp_number<B>, V >(a.left_ref(), b));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::add_immediates, mp_number<B, true>, V > >(detail::mp_exp<detail::add_immediates, mp_number<B, true>, V >(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, V, mp_number<B> > >::type
- operator - (const V& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::add_immediates, V, mp_number<B, true> > >::type
+ operator - (const V& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::add_immediates, V, mp_number<B> >(a, b.left_ref());
+ return detail::mp_exp<detail::add_immediates, V, mp_number<B, true> >(a, b.left_ref());
}
//
// Multiplication:
//
template <class B>
-inline detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> >
- operator * (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator * (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::multiply_immediates, mp_number<B>, V > >::type
- operator * (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V > >::type
+ operator * (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::multiply_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::multiply_immediates, V, mp_number<B> > >::type
- operator * (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::multiply_immediates, V, mp_number<B, true> > >::type
+ operator * (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::multiply_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::multiply_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::multiplies, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator * (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::multiplies, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator * (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::multiplies, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::multiplies, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::multiplies, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator * (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::multiplies, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator * (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::multiplies, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::multiplies, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::multiplies, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -749,79 +749,79 @@
// Repeat operator for negated arguments: propagate the negation to the top level to avoid temporaries:
//
template <class B, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
- operator * (const mp_number<B>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
+ operator * (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
- detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > (a, b.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
+ detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > (a, b.left_ref()));
}
template <class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
- operator * (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
+ operator * (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
- detail::mp_exp<detail::multiplies, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
+ detail::mp_exp<detail::multiplies, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(b, a.left_ref()));
}
template <class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> > >
- operator * (const mp_number<B>& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> > >
+ operator * (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> > >(
- detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> >(a, b.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> > >(
+ detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> >(a, b.left_ref()));
}
template <class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> > >
- operator * (const detail::mp_exp<detail::negate, mp_number<B> >& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> > >
+ operator * (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> > >(
- detail::mp_exp<detail::multiply_immediates, mp_number<B>, mp_number<B> >(b, a.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> > >(
+ detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, mp_number<B, true> >(b, a.left_ref()));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, V > > >::type
- operator * (const detail::mp_exp<detail::negate, mp_number<B> >& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V > > >::type
+ operator * (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const V& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, V > > (
- detail::mp_exp<detail::multiply_immediates, mp_number<B>, V >(a.left_ref(), b));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V > > (
+ detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V >(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, V > > >::type
- operator * (const V& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V > > >::type
+ operator * (const V& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B>, V > >(
- detail::mp_exp<detail::multiply_immediates, mp_number<B>, V >(b.left_ref(), a));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V > >(
+ detail::mp_exp<detail::multiply_immediates, mp_number<B, true>, V >(b.left_ref(), a));
}
//
// Division:
//
template <class B>
-inline detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> >
- operator / (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator / (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::divide_immediates, mp_number<B>, V > >::type
- operator / (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, V > >::type
+ operator / (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::divide_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::divide_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::divide_immediates, V, mp_number<B> > >::type
- operator / (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::divide_immediates, V, mp_number<B, true> > >::type
+ operator / (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::divide_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::divide_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::divides, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator / (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::divides, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator / (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::divides, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::divides, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::divides, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator / (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::divides, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator / (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::divides, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::divides, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::divides, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -845,79 +845,79 @@
// Repeat operator for negated arguments: propagate the negation to the top level to avoid temporaries:
//
template <class B, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
- operator / (const mp_number<B>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >
+ operator / (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
- detail::mp_exp<detail::divides, mp_number<B>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type > >(
+ detail::mp_exp<detail::divides, mp_number<B, true>, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type >(a, b.left_ref()));
}
template <class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B> > >
- operator / (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B, true> > >
+ operator / (const detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B> > >(
- detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B> >(a.left_ref(), b));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B, true> > >(
+ detail::mp_exp<detail::divides, typename detail::mp_exp<detail::negate, Arg1, Arg2, Arg3>::left_type, mp_number<B, true> >(a.left_ref(), b));
}
template <class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> > >
- operator / (const mp_number<B>& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> > >
+ operator / (const mp_number<B, true>& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> > >(
- detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> >(a, b.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> > >(
+ detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> >(a, b.left_ref()));
}
template <class B>
-inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> > >
- operator / (const detail::mp_exp<detail::negate, mp_number<B> >& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> > >
+ operator / (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> > >(
- detail::mp_exp<detail::divide_immediates, mp_number<B>, mp_number<B> >(a.left_ref(), b));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> > >(
+ detail::mp_exp<detail::divide_immediates, mp_number<B, true>, mp_number<B, true> >(a.left_ref(), b));
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, V > > >::type
- operator / (const detail::mp_exp<detail::negate, mp_number<B> >& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, V > > >::type
+ operator / (const detail::mp_exp<detail::negate, mp_number<B, true> >& a, const V& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B>, V > >(
- detail::mp_exp<detail::divide_immediates, mp_number<B>, V>(a.left_ref(), b));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, mp_number<B, true>, V > >(
+ detail::mp_exp<detail::divide_immediates, mp_number<B, true>, V>(a.left_ref(), b));
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, V, mp_number<B> > > >::type
- operator / (const V& a, const detail::mp_exp<detail::negate, mp_number<B> >& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, V, mp_number<B, true> > > >::type
+ operator / (const V& a, const detail::mp_exp<detail::negate, mp_number<B, true> >& b)
{
- return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, V, mp_number<B> > >(
- detail::mp_exp<detail::divide_immediates, V, mp_number<B> >(a, b.left_ref()));
+ return detail::mp_exp<detail::negate, detail::mp_exp<detail::divide_immediates, V, mp_number<B, true> > >(
+ detail::mp_exp<detail::divide_immediates, V, mp_number<B, true> >(a, b.left_ref()));
}
//
// Modulus:
//
template <class B>
-inline detail::mp_exp<detail::modulus_immediates, mp_number<B>, mp_number<B> >
- operator % (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::modulus_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator % (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::modulus_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::modulus_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::modulus_immediates, mp_number<B>, V > >::type
- operator % (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::modulus_immediates, mp_number<B, true>, V > >::type
+ operator % (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::modulus_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::modulus_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::modulus_immediates, V, mp_number<B> > >::type
- operator % (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::modulus_immediates, V, mp_number<B, true> > >::type
+ operator % (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::modulus_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::modulus_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::modulus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator % (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::modulus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator % (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::modulus, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::modulus, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::modulus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator % (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::modulus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator % (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::modulus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::modulus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::modulus, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -941,10 +941,10 @@
// Left shift:
//
template <class B, class I>
-inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_left, mp_number<B>, I > >::type
- operator << (const mp_number<B>& a, const I& b)
+inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_left, mp_number<B, true>, I > >::type
+ operator << (const mp_number<B, true>& a, const I& b)
{
- return detail::mp_exp<detail::shift_left, mp_number<B>, I>(a, b);
+ return detail::mp_exp<detail::shift_left, mp_number<B, true>, I>(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class I>
inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_left, detail::mp_exp<tag, Arg1, Arg2, Arg3>, I> >::type
@@ -956,10 +956,10 @@
// Right shift:
//
template <class B, class I>
-inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_right, mp_number<B>, I > >::type
- operator >> (const mp_number<B>& a, const I& b)
+inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_right, mp_number<B, true>, I > >::type
+ operator >> (const mp_number<B, true>& a, const I& b)
{
- return detail::mp_exp<detail::shift_right, mp_number<B>, I>(a, b);
+ return detail::mp_exp<detail::shift_right, mp_number<B, true>, I>(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class I>
inline typename enable_if<is_integral<I>, detail::mp_exp<detail::shift_right, detail::mp_exp<tag, Arg1, Arg2, Arg3>, I> >::type
@@ -971,34 +971,34 @@
// Bitwise AND:
//
template <class B>
-inline detail::mp_exp<detail::bitwise_and_immediates, mp_number<B>, mp_number<B> >
- operator & (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_and_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator & (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_and_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_and_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_and_immediates, mp_number<B>, V > >::type
- operator & (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_and_immediates, mp_number<B, true>, V > >::type
+ operator & (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::bitwise_and_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::bitwise_and_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_and_immediates, V, mp_number<B> > >::type
- operator & (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_and_immediates, V, mp_number<B, true> > >::type
+ operator & (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_and_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_and_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::bitwise_and, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator & (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::bitwise_and, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator & (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::bitwise_and, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::bitwise_and, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::bitwise_and, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator & (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_and, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator & (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_and, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_and, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::bitwise_and, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -1022,34 +1022,34 @@
// Bitwise OR:
//
template <class B>
-inline detail::mp_exp<detail::bitwise_or_immediates, mp_number<B>, mp_number<B> >
- operator| (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_or_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator| (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_or_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_or_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_or_immediates, mp_number<B>, V > >::type
- operator| (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_or_immediates, mp_number<B, true>, V > >::type
+ operator| (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::bitwise_or_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::bitwise_or_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_or_immediates, V, mp_number<B> > >::type
- operator| (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_or_immediates, V, mp_number<B, true> > >::type
+ operator| (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_or_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_or_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::bitwise_or, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator| (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::bitwise_or, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator| (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::bitwise_or, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::bitwise_or, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::bitwise_or, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator| (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_or, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator| (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_or, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_or, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::bitwise_or, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -1073,34 +1073,34 @@
// Bitwise XOR:
//
template <class B>
-inline detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B>, mp_number<B> >
- operator^ (const mp_number<B>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B, true>, mp_number<B, true> >
+ operator^ (const mp_number<B, true>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B, true>, mp_number<B, true> >(a, b);
}
template <class B, class V>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B>, V > >::type
- operator^ (const mp_number<B>& a, const V& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B, true>, V > >::type
+ operator^ (const mp_number<B, true>& a, const V& b)
{
- return detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B>, V >(a, b);
+ return detail::mp_exp<detail::bitwise_xor_immediates, mp_number<B, true>, V >(a, b);
}
template <class V, class B>
-inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_xor_immediates, V, mp_number<B> > >::type
- operator^ (const V& a, const mp_number<B>& b)
+inline typename enable_if<is_arithmetic<V>, detail::mp_exp<detail::bitwise_xor_immediates, V, mp_number<B, true> > >::type
+ operator^ (const V& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_xor_immediates, V, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_xor_immediates, V, mp_number<B, true> >(a, b);
}
template <class B, class tag, class Arg1, class Arg2, class Arg3>
-inline detail::mp_exp<detail::bitwise_xor, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
- operator^ (const mp_number<B>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
+inline detail::mp_exp<detail::bitwise_xor, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >
+ operator^ (const mp_number<B, true>& a, const detail::mp_exp<tag, Arg1, Arg2, Arg3>& b)
{
- return detail::mp_exp<detail::bitwise_xor, mp_number<B>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
+ return detail::mp_exp<detail::bitwise_xor, mp_number<B, true>, detail::mp_exp<tag, Arg1, Arg2, Arg3> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class B>
-inline detail::mp_exp<detail::bitwise_xor, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >
- operator^ (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B>& b)
+inline detail::mp_exp<detail::bitwise_xor, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >
+ operator^ (const detail::mp_exp<tag, Arg1, Arg2, Arg3>& a, const mp_number<B, true>& b)
{
- return detail::mp_exp<detail::bitwise_xor, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B> >(a, b);
+ return detail::mp_exp<detail::bitwise_xor, detail::mp_exp<tag, Arg1, Arg2, Arg3>, mp_number<B, true> >(a, b);
}
template <class tag, class Arg1, class Arg2, class Arg3, class tag2, class Arg1b, class Arg2b, class Arg3b>
inline detail::mp_exp<detail::bitwise_xor, detail::mp_exp<tag, Arg1, Arg2, Arg3>, detail::mp_exp<tag2, Arg1b, Arg2b, Arg3b> >
@@ -1134,15 +1134,15 @@
template <class Num>
struct number_category : public mpl::int_<number_kind_floating_point> {};
-template <class Backend>
-struct number_category<mp_number<Backend> > : public number_category<Backend>{};
+template <class Backend, bool ExpressionTemplates>
+struct number_category<mp_number<Backend, ExpressionTemplates> > : public number_category<Backend>{};
template <class tag, class A1, class A2, class A3>
struct number_category<detail::mp_exp<tag, A1, A2, A3> > : public number_category<typename detail::mp_exp<tag, A1, A2, A3>::result_type>{};
template <class T>
struct component_type;
-template <class T>
-struct component_type<mp_number<T> > : public component_type<T>{};
+template <class T, bool ExpressionTemplates>
+struct component_type<mp_number<T, ExpressionTemplates> > : public component_type<T>{};
template <class tag, class A1, class A2, class A3>
struct component_type<detail::mp_exp<tag, A1, A2, A3> > : public component_type<typename detail::mp_exp<tag, A1, A2, A3>::result_type>{};
Modified: sandbox/big_number/boost/multiprecision/fixed_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/fixed_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/fixed_int.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -1517,10 +1517,10 @@
namespace std{
-template <unsigned Bits, bool Signed>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed> > >
+template <unsigned Bits, bool Signed, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed>, ExpressionTemplates> number_type;
struct initializer
{
@@ -1591,9 +1591,9 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template <unsigned Bits, bool Signed>
-typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed> > >::initializer const
- numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed> > >::init;
+template <unsigned Bits, bool Signed, bool ExpressionTemplates>
+typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed>, ExpressionTemplates> >::initializer const
+ numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<Bits, Signed>, ExpressionTemplates> >::init;
}
#endif
Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -1816,10 +1816,10 @@
//
// numeric_limits [partial] specializations for the types declared in this header:
//
-template<unsigned Digits10>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10> > >
+template<unsigned Digits10, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
//
@@ -1924,13 +1924,13 @@
static const data_initializer initializer;
};
-template<unsigned Digits10>
-const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10> > >::data_initializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10> > >::initializer;
+template<unsigned Digits10, bool ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<Digits10>, ExpressionTemplates> >::initializer;
-template<>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<0> > >
+template<bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_float<0>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_float<0> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_float<0>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = false;
static number_type (min)() BOOST_MP_NOEXCEPT { return number_type(); }
@@ -1966,10 +1966,10 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template<>
-class numeric_limits<boost::multiprecision::mpz_int >
+template<bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_int, ExpressionTemplates> >
{
- typedef boost::multiprecision::mpz_int number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_int, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
//
@@ -2015,10 +2015,10 @@
BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
};
-template<>
-class numeric_limits<boost::multiprecision::mpq_rational >
+template<bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::gmp_rational, ExpressionTemplates> >
{
- typedef boost::multiprecision::mpq_rational number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::gmp_rational, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
//
Modified: sandbox/big_number/boost/multiprecision/mp_number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mp_number.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mp_number.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -23,10 +23,10 @@
namespace boost{ namespace multiprecision{
-template <class Backend>
+template <class Backend, bool ExpressionTemplates>
class mp_number
{
- typedef mp_number<Backend> self_type;
+ typedef mp_number<Backend, ExpressionTemplates> self_type;
public:
typedef Backend backend_type;
mp_number(){}
@@ -49,8 +49,11 @@
m_backend = canonical_value(v);
}
*/
- template <class Other>
- mp_number(const mp_number<Other>& val, typename enable_if<boost::is_convertible<Other, Backend> >::type* dummy1 = 0)
+ template<bool ET>
+ mp_number(const mp_number<Backend, ET>& val) : m_backend(val.m_backend) {}
+
+ template <class Other, bool ET>
+ mp_number(const mp_number<Other, ET>& val, typename enable_if<boost::is_convertible<Other, Backend> >::type* dummy1 = 0)
{
m_backend = val.backend();
}
@@ -60,8 +63,8 @@
using default_ops::assign_components;
assign_components(m_backend, canonical_value(v1), canonical_value(v2));
}
- template <class Other>
- mp_number(const mp_number<Other>& v1, const mp_number<Other>& v2, typename enable_if<boost::is_convertible<Other, Backend> >::type* dummy1 = 0)
+ template <class Other, bool ET>
+ mp_number(const mp_number<Other, ET>& v1, const mp_number<Other, ET>& v2, typename enable_if<boost::is_convertible<Other, Backend> >::type* dummy1 = 0)
{
using default_ops::assign_components;
assign_components(m_backend, v1.backend(), v2.backend());
@@ -85,7 +88,7 @@
}
template <class V>
- typename enable_if<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> >, mp_number<Backend>& >::type
+ typename enable_if<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> >, mp_number<Backend, ExpressionTemplates>& >::type
operator=(const V& v)
{
m_backend = canonical_value(v);
@@ -93,15 +96,22 @@
}
template <class V>
- typename enable_if<mpl::and_<is_convertible<V, Backend>, mpl::not_<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> > > >, mp_number<Backend>& >::type
+ typename enable_if<mpl::and_<is_convertible<V, Backend>, mpl::not_<mpl::or_<boost::is_arithmetic<V>, is_same<std::string, V>, is_convertible<V, const char*> > > >, mp_number<Backend, ExpressionTemplates>& >::type
operator=(const V& v)
{
m_backend = v;
return *this;
}
+ template <bool ET>
+ mp_number& operator=(const mp_number<Backend, ET>& v)
+ {
+ m_backend = v.backend();
+ return *this;
+ }
+
template <class Other>
- typename enable_if<is_convertible<Other, Backend>, mp_number<Backend>& >::type
+ typename enable_if<is_convertible<Other, Backend>, mp_number<Backend, ExpressionTemplates>& >::type
operator=(const mp_number<Other>& v)
{
m_backend = v.backend();
@@ -147,7 +157,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_number<Backend, ExpressionTemplates>& >::type
operator+=(const V& v)
{
using default_ops::eval_add;
@@ -178,7 +188,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_number<Backend, ExpressionTemplates>& >::type
operator-=(const V& v)
{
using default_ops::eval_subtract;
@@ -211,7 +221,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_number<Backend, ExpressionTemplates>& >::type
operator*=(const V& v)
{
using default_ops::eval_multiply;
@@ -242,7 +252,7 @@
return *this;
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_number<Backend, ExpressionTemplates>& >::type
operator%=(const V& v)
{
BOOST_STATIC_ASSERT_MSG(number_category<Backend>::value == number_kind_integer, "The modulus operation is only valid for integer types");
@@ -330,7 +340,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_number<Backend, ExpressionTemplates>& >::type
operator/=(const V& v)
{
using default_ops::eval_divide;
@@ -364,7 +374,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_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");
@@ -399,7 +409,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_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");
@@ -432,7 +442,7 @@
}
template <class V>
- typename enable_if<boost::is_arithmetic<V>, mp_number<Backend>& >::type
+ typename enable_if<boost::is_arithmetic<V>, mp_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");
@@ -507,7 +517,7 @@
//
// Comparison:
//
- int compare(const mp_number<Backend>& o)const
+ int compare(const mp_number<Backend, ExpressionTemplates>& o)const
{
return m_backend.compare(o.m_backend);
}
@@ -1377,7 +1387,7 @@
template <class Exp>
bool contains_self(const Exp& e, mpl::int_<0> const&)const
{
- return is_floatly_self(e.value());
+ return is_realy_self(e.value());
}
template <class Exp>
bool contains_self(const Exp& e, mpl::int_<1> const&)const
@@ -1413,7 +1423,7 @@
template <class Exp>
bool is_self(const Exp& e, mpl::int_<0> const&)const
{
- return is_floatly_self(e.value());
+ return is_realy_self(e.value());
}
template <class Exp, int v>
bool is_self(const Exp& e, mpl::int_<v> const&)const
@@ -1422,8 +1432,8 @@
}
template <class Val>
- bool is_floatly_self(const Val&)const { return false; }
- bool is_floatly_self(const self_type& v)const { return &v == this; }
+ bool is_realy_self(const Val&)const { return false; }
+ bool is_realy_self(const self_type& v)const { return &v == this; }
static const Backend& canonical_value(const self_type& v){ return v.m_backend; }
template <class V>
@@ -1439,32 +1449,32 @@
namespace detail
{
-template <class Backend>
-inline int mp_number_compare(const mp_number<Backend>& a, const mp_number<Backend>& b)
+template <class Backend, bool ExpressionTemplates>
+inline int mp_number_compare(const mp_number<Backend, ExpressionTemplates>& a, const mp_number<Backend, ExpressionTemplates>& b)
{
return a.compare(b);
}
-template <class Backend, class tag, class A1, class A2, class A3>
-inline int mp_number_compare(const mp_number<Backend>& a, const mp_exp<tag, A1, A2, A3>& b)
+template <class Backend, bool ExpressionTemplates, class tag, class A1, class A2, class A3>
+inline int mp_number_compare(const mp_number<Backend, ExpressionTemplates>& a, const mp_exp<tag, A1, A2, A3>& b)
{
- return a.compare(mp_number<Backend>(b));
+ return a.compare(mp_number<Backend, ExpressionTemplates>(b));
}
-template <class tag, class A1, class A2, class A3, class Backend>
-inline int mp_number_compare(const mp_exp<tag, A1, A2, A3>& a, const mp_number<Backend>& b)
+template <class tag, class A1, class A2, class A3, class Backend, bool ExpressionTemplates>
+inline int mp_number_compare(const mp_exp<tag, A1, A2, A3>& a, const mp_number<Backend, ExpressionTemplates>& b)
{
- return -b.compare(mp_number<Backend>(a));
+ return -b.compare(mp_number<Backend, ExpressionTemplates>(a));
}
-template <class Backend, class Val>
-inline int mp_number_compare(const mp_number<Backend>& a, const Val b)
+template <class Backend, bool ExpressionTemplates, class Val>
+inline int mp_number_compare(const mp_number<Backend, ExpressionTemplates>& a, const Val b)
{
return a.compare(b);
}
-template <class Val, class Backend>
-inline int mp_number_compare(const Val a, const mp_number<Backend>& b)
+template <class Val, class Backend, bool ExpressionTemplates>
+inline int mp_number_compare(const Val a, const mp_number<Backend, ExpressionTemplates>& b)
{
return -b.compare(a);
}
@@ -1569,8 +1579,8 @@
return 0 < detail::mp_number_compare(a, b);
}
-template <class Backend>
-inline std::ostream& operator << (std::ostream& os, const mp_number<Backend>& r)
+template <class Backend, bool ExpressionTemplates>
+inline std::ostream& operator << (std::ostream& os, const mp_number<Backend, ExpressionTemplates>& r)
{
std::streamsize d = os.precision();
std::string s = r.str(d, os.flags());
@@ -1598,8 +1608,8 @@
} // namespace detail
-template <class Backend>
-inline std::istream& operator >> (std::istream& is, mp_number<Backend>& r)
+template <class Backend, bool ExpressionTemplates>
+inline std::istream& operator >> (std::istream& is, mp_number<Backend, ExpressionTemplates>& r)
{
std::string s;
is >> s;
@@ -1607,8 +1617,8 @@
return is;
}
-template <class Backend>
-inline void swap(mp_number<Backend>& a, mp_number<Backend>& b)
+template <class Backend, bool ExpressionTemplates>
+inline void swap(mp_number<Backend, ExpressionTemplates>& a, mp_number<Backend, ExpressionTemplates>& b)
{
a.swap(b);
}
@@ -1618,11 +1628,11 @@
template <class T>
class rational;
-template <class Backend>
-inline std::istream& operator >> (std::istream& is, rational<multiprecision::mp_number<Backend> >& r)
+template <class Backend, bool ExpressionTemplates>
+inline std::istream& operator >> (std::istream& is, rational<multiprecision::mp_number<Backend, ExpressionTemplates> >& r)
{
std::string s1;
- multiprecision::mp_number<Backend> v1, v2;
+ multiprecision::mp_number<Backend, ExpressionTemplates> v1, v2;
char c;
bool have_hex = false;
@@ -1653,38 +1663,38 @@
return is;
}
-template <class T, class Arithmetic>
-typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator == (const rational<multiprecision::mp_number<T> >& a, const Arithmetic& b)
+template <class T, bool ExpressionTemplates, class Arithmetic>
+typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator == (const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a, const Arithmetic& b)
{
- return a == multiprecision::mp_number<T>(b);
+ return a == multiprecision::mp_number<T, ExpressionTemplates>(b);
}
-template <class T, class Arithmetic>
-typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator == (const Arithmetic& b, const rational<multiprecision::mp_number<T> >& a)
+template <class T, bool ExpressionTemplates, class Arithmetic>
+typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator == (const Arithmetic& b, const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a)
{
- return a == multiprecision::mp_number<T>(b);
+ return a == multiprecision::mp_number<T, ExpressionTemplates>(b);
}
-template <class T, class Arithmetic>
-typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator != (const rational<multiprecision::mp_number<T> >& a, const Arithmetic& b)
+template <class T, bool ExpressionTemplates, class Arithmetic>
+typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator != (const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a, const Arithmetic& b)
{
- return a != multiprecision::mp_number<T>(b);
+ return a != multiprecision::mp_number<T, ExpressionTemplates>(b);
}
-template <class T, class Arithmetic>
-typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator != (const Arithmetic& b, const rational<multiprecision::mp_number<T> >& a)
+template <class T, bool ExpressionTemplates, class Arithmetic>
+typename enable_if<boost::is_arithmetic<Arithmetic>, bool>::type operator != (const Arithmetic& b, const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a)
{
- return a != multiprecision::mp_number<T>(b);
+ return a != multiprecision::mp_number<T, ExpressionTemplates>(b);
}
-template <class T>
-inline multiprecision::mp_number<T> numerator(const rational<multiprecision::mp_number<T> >& a)
+template <class T, bool ExpressionTemplates>
+inline multiprecision::mp_number<T, ExpressionTemplates> numerator(const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a)
{
return a.numerator();
}
-template <class T>
-inline multiprecision::mp_number<T> denominator(const rational<multiprecision::mp_number<T> >& a)
+template <class T, bool ExpressionTemplates>
+inline multiprecision::mp_number<T, ExpressionTemplates> denominator(const rational<multiprecision::mp_number<T, ExpressionTemplates> >& a)
{
return a.denominator();
}
Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -1011,6 +1011,11 @@
{
return boost::multiprecision::backends::detail::get_default_precision();
}
+template <>
+inline int digits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<0>, false> >()
+{
+ return boost::multiprecision::backends::detail::get_default_precision();
+}
}
@@ -1021,10 +1026,10 @@
//
// numeric_limits [partial] specializations for the types declared in this header:
//
-template<unsigned Digits10>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10> > >
+template<unsigned Digits10, bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
BOOST_STATIC_CONSTEXPR number_type (min)() BOOST_MP_NOEXCEPT
@@ -1153,13 +1158,13 @@
static const data_initializer initializer;
};
-template<unsigned Digits10>
-const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10> > >::data_initializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10> > >::initializer;
+template<unsigned Digits10, bool ExpressionTemplates>
+const typename numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::data_initializer numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<Digits10>, ExpressionTemplates> >::initializer;
-template<>
-class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<0> > >
+template<bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<0>, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<0> > number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::mpfr_float_backend<0>, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = false;
static number_type (min)() BOOST_MP_NOEXCEPT { return number_type(0); }
Modified: sandbox/big_number/boost/multiprecision/rational_adapter.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/rational_adapter.hpp (original)
+++ sandbox/big_number/boost/multiprecision/rational_adapter.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -179,11 +179,11 @@
result.data().assign(v1, v2);
}
-template<class IntBackend>
-struct number_category<rational_adapter<IntBackend> > : public mpl::int_<number_kind_rational>{};
-
} // namespace backends
+template<class IntBackend>
+struct number_category<backends::rational_adapter<IntBackend> > : public mpl::int_<number_kind_rational>{};
+
using boost::multiprecision::backends::rational_adapter;
template <class T>
Modified: sandbox/big_number/boost/multiprecision/tommath.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/tommath.hpp (original)
+++ sandbox/big_number/boost/multiprecision/tommath.hpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -457,10 +457,10 @@
namespace std{
-template<>
-class numeric_limits<boost::multiprecision::mp_int >
+template<bool ExpressionTemplates>
+class numeric_limits<boost::multiprecision::mp_number<boost::multiprecision::tommath_int, ExpressionTemplates> >
{
- typedef boost::multiprecision::mp_int number_type;
+ typedef boost::multiprecision::mp_number<boost::multiprecision::tommath_int, ExpressionTemplates> number_type;
public:
BOOST_STATIC_CONSTEXPR bool is_specialized = true;
//
Modified: sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk (original)
+++ sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -60,6 +60,17 @@
my_float a, b, c; // These variables have 300 decimal digits precision
+We can repeat the above example, but with the expression templates disabled (for faster compile times, but slower runtimes)
+by passing a second template argument to `mp_number`:
+
+ #include <boost/multiprecision/mpfr.hpp> // Defines the Backend type that wraps MPFR
+
+ namespace mp = boost::multiprecision; // Reduce the typing a bit later...
+
+ typedef mp::mp_number<mp::mpfr_float_backend<300>, false> my_float;
+
+ my_float a, b, c; // These variables have 300 decimal digits precision
+
[h4 Expression Templates]
Class `mp_number` is expression-template-enabled: that means that rather than having a multiplication
@@ -176,6 +187,9 @@
transformation is more efficient than creating the extra temporary variable, just not by as much as
one would hope.
+Finally, note that `mp_number` takes a second template argument, which, when set to `false` disables all
+the expression template machinary. The result is much faster to compile, but slower at runtime.
+
We'll conclude this section by providing some more performance comparisons between these three libraries,
again, all are using [mpfr] to carry out the underlying arithmetic, and all are operating at the same precision
(50 decimal digits):
@@ -209,7 +223,8 @@
[[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
[[`gmp_int`][boost/multiprecision/gmp.hpp][2][[gmp]][Very fast and efficient backend.][Dependency on GNU licenced [gmp] library.]]
[[`mp_int`][boost/multiprecision/tommath.hpp][2][libtommath][Public domain backend with no licence restrictions.][Slower than [gmp].]]
-[[`fixed_int`][boost/multiprecision/fixed_int.hpp][2][None][Boost licenced fixed precision modular arithmetic integer.][Slower than [gmp].]]
+[[`cpp_int`][boost/multiprecision/cpp_int.hpp][2][None]
+ [Very versatile, Boost licenced, all C++ integer type which support both arbitrary precision and fixed precision integer types.][Slower than [gmp].]]
]
[h4 gmp_int]
@@ -277,46 +292,76 @@
[tommath_eg]
-[h4 fixed_int]
+[h4 cpp_int]
namespace boost{ namespace multiprecision{
- template <unsigned Digits, bool Signed>
- class fixed_int;
+ typedef unspecified-type limb_type;
- typedef mp_number<fixed_int<128, false> > mp_uint128_t;
- typedef mp_number<fixed_int<256, false> > mp_uint256_t;
- typedef mp_number<fixed_int<512, false> > mp_uint512_t;
-
- typedef mp_number<fixed_int<128, true> > mp_int128_t;
- typedef mp_number<fixed_int<256, true> > mp_int256_t;
- typedef mp_number<fixed_int<512, true> > mp_int512_t;
+ template <unsigned MinDigits = 0, bool Signed = true, class Allocator = std::allocator<limb_type> >
+ class cpp_int_backend;
+
+ typedef mp_number<cpp_int_backend<> > cpp_int; // arbitrary precision integer
+ typedef rational_adapter<cpp_int_backend<> > cpp_rational_backend;
+ typedef mp_number<cpp_rational_backend> cpp_rational; // arbitrary precision rational number
+
+ // Fixed precision unsigned types:
+ typedef mp_number<cpp_int<128, false, void> > mp_uint128_t;
+ typedef mp_number<fixed_int<256, false, void> > mp_uint256_t;
+ typedef mp_number<fixed_int<512, false, void> > mp_uint512_t;
+
+ // Fixed precision signed types:
+ typedef mp_number<fixed_int<128, true, void> > mp_int128_t;
+ typedef mp_number<fixed_int<256, true, void> > mp_int256_t;
+ typedef mp_number<fixed_int<512, true, void> > mp_int512_t;
}} // namespaces
-The `fixed_int` backend is used via one of the typedefs `boost::multiprecision::mp_uint128_t`, `boost::multiprecision::mp_uint256_t`,
+The `cpp_int_backend` type is used via one of the typedefs `boost::multiprecision::cpp_int`,
+`boost::multiprecision::mp_uint128_t`, `boost::multiprecision::mp_uint256_t`,
`boost::multiprecision::mp_uint512_t`, `boost::multiprecision::mp_int128_t`, `boost::multiprecision::mp_int256_t`
-or `boost::multiprecision::mp_int512_t`. It provides both signed and unsigned integer types with a fixed precision
-and modular arithmetic with a 2's complement representation for negative values. In other words it's designed to work just
-like a typical built in integer type, but with larger precision.
+or `boost::multiprecision::mp_int512_t`.
+
+This backend is the "Swiss Army Knife" of integer types as it can represent both fixed and arbitrary precision
+integer types, and both signed and unsigned types. There are three template arguments:
+
+[variablelist
+[[MinBits][Determines the number of Bits to store directly within the object before resorting to dynamic memory
+ allocation. When zero, this field is determined automatically based on how many bits can be stored
+ in union with the dynamic storage header: setting a larger value may improve performance as larger integer
+ values will be stored internally before memory allocation is required.
+ When the Allocator parameter is type `void`, then this field
+ determines the total number of bits in the resulting fixed precision type.]]
+[[Signed][Determines whether the resulting type is signed or not. Note that for arbitrary precision types
+ (where the Allocator parameter is non-void), then this parameter must be `true`. For fixed precision
+ types then this type may be either `true` (type is signed), or `false` (type is unsigned).]]
+[[Allocator][The allocator to use for dymamic memory allocation, or type `void` if this is to be a fixed precision type.]]
+]
Things you should know when using this type:
-* Default constructed `fixed_int`'s have indeterminate value - just like normal built in integers.
+* Default constructed `cpp_int_backend`'s have the value zero.
* Division by zero results in a `std::runtime_error` being thrown.
* Construction from a string that contains invalid non-numeric characters results in a `std::runtime_error` being thrown.
-* Since the precision of `fixed_int` is necessarily limited, care should be taken to avoid numeric overflow when using this type
+* Since the precision of `cpp_int_backend` is necessarily limited when the allocator parameter is void,
+care should be taken to avoid numeric overflow when using this type
unless you actually want modulo-arithmetic behavior.
+* The type uses a sign-magnitude representation internally, so type `mp_int128_t` has 128-bits of precision plus an extra sign bit.
+In this respect the behaviour of these types differs from built-in 2's complement types. In might be tempting to use a
+127-bit type instead, and indeed this does work, but behaviour is still slightly different from a 2's complement built-in type
+as the min and max values are identical (apart from the sign), where as they differ by one for a true 2's complement type.
+That said it should be noted that there's no requirement for built-in types to be 2's complement either - it's simply that this
+is the most common format by far.
[h5 Example:]
-[fixed_int_eg]
+[cpp_int_eg]
[endsect]
-[section:reals Real Numbers]
+[section:reals Floating Point Numbers]
-The following backends provide real number arithmetic:
+The following backends provide floating point arithmetic:
[table
[[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
@@ -471,7 +516,8 @@
[table
[[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
[[`gmp_rational`][boost/multiprecision/gmp.hpp][2][[gmp]][Very fast and efficient backend.][Dependency on GNU licenced [gmp] library.]]
-[[`tommath_rational`][boost/multiprecision/tommath.hpp][2][libtommath][All C/C++ implementation that's Boost Software Licence compatible.][Slower than [gmp].]]
+[[`cpp_rational`][boost/multiprecision/cpp_int.hpp][2][None][An all C++ Boost-licenced implementation.][[Slower than [gmp].]]
+[[`tommath_rational`][boost/multiprecision/tommath.hpp][2][libtommath][All C/C++ implementation that's Boost Software Licence compatible.]
[[`rational_adapter`][boost/multiprecision/rational_adapter.hpp][N/A][none][All C++ adapter that allows any inetger backend type to be used as a rational type.][Requires an underlying integer backend type.]]
[[`boost::rational`][boost/rational.hpp][N/A][None][A C++ rational number type that can used with any `mp_number` integer type.][The expression templates used by `mp_number` end up being "hidden" inside `boost::rational`: performance may well suffer as a result.]]
]
@@ -516,6 +562,38 @@
[mpq_eg]
+[h4 cpp_rational]
+
+ namespace boost{ namespace multiprecision{
+
+ typedef rational_adapter<cpp_int_backend<> > cpp_rational_backend;
+
+ typedef mp_number<cpp_rational_backend> cpp_rational;
+
+ }} // namespaces
+
+The `cpp_rational_backend` type is used via the typedef `boost::multiprecision::cpp_rational`. It provides
+a rational number type that is a drop-in replacement for the native C++ number types, but with unlimited precision.
+
+As well as the usual conversions from arithmetic and string types, instances of `cpp_rational` are copy constructible
+and assignable from type `cpp_int`.
+
+There are also non-member functions:
+
+ cpp_int numerator(const cpp_rational&);
+ cpp_int denominator(const cpp_rational&);
+
+which return the numerator and denominator of the number.
+
+Things you should know when using this type:
+
+* Default constructed `cpp_rational`'s have the value zero.
+* Division by zero results in a `std::rumtime_error` being thrown.
+
+[h5 Example:]
+
+[cpp_rational_eg]
+
[h4 tommath_rational]
namespace boost{ namespace multiprecision{
@@ -592,7 +670,7 @@
namespace boost{ namespace multiprecision{
- template <class Backend>
+ template <class Backend, bool ExpressionTemplates = true>
class mp_number
{
mp_number();
@@ -621,13 +699,13 @@
// swap:
void swap(mp_number& other);
// Sign:
- bool eval_is_zero()const;
+ bool is_zero()const;
int sign()const;
// string conversion:
std::string str()const;
// Generic conversion mechanism
template <class T>
- T eval_convert_to()const;
+ T convert_to()const;
// precision control:
static unsigned default_precision();
static void default_precision(unsigned digits10);
@@ -663,15 +741,15 @@
bool operator>=(const ``['see-below]``&, const ``['see-below]``&);
// Swap:
- template <class Backend>
- void swap(mp_number<Backend>& a, mp_number<Backend>& b);
+ template <class Backend, bool ExpressionTemplates>
+ void swap(mp_number<Backend, ExpressionTemplates>& a, mp_number<Backend, ExpressionTemplates>& b);
// iostream support:
- template <class Backend>
- std::ostream& operator << (std::ostream& os, const mp_number<Backend>& r);
+ template <class Backend, bool ExpressionTemplates>
+ std::ostream& operator << (std::ostream& os, const mp_number<Backend, ExpressionTemplates>& r);
std::ostream& operator << (std::ostream& os, const ``['unmentionable-expression-template-type]``& r);
- template <class Backend>
- std::istream& operator >> (std::istream& is, mp_number<Backend>& r);
+ template <class Backend, bool ExpressionTemplates>
+ std::istream& operator >> (std::istream& is, mp_number<Backend, ExpressionTemplates>& r);
// Non-member function standard library support:
``['unmentionable-expression-template-type]`` abs (const ``['mp_number-or-expression-template-type]``&);
@@ -732,8 +810,8 @@
// numeric_limits support:
namespace std{
- template <class Backend>
- struct numeric_limits<boost::multiprecision<Backend> >
+ template <class Backend, bool ExpressionTemplates>
+ struct numeric_limits<boost::multiprecision<Backend, ExpressionTemplates> >
{
/* Usual members here */
};
@@ -742,6 +820,16 @@
[h4 Description]
+ template <class Backend, bool ExpressionTemplates = true>
+ class mp_number;
+
+Class `mp_number` has two template arguments:
+
+[variablelist
+[[Backend][The actual arithmetic backend that does all the work.]]
+[[ExpressionTemplates][A boolean value: when true, then expression templates are enabled, otherwise they are disabled.]]
+]
+
mp_number();
mp_number(see-below);
mp_number& operator=(see-below);
@@ -781,7 +869,7 @@
The arguments to these operators is either:
-* Another `mp_number<Backend>`.
+* Another `mp_number<Backend, ExpressionTemplates>`.
* A builtin arithmetic type.
* An expression template derived from `mp_number<Backend>`.
@@ -801,7 +889,7 @@
Swaps `*this` with `other`.
- bool eval_is_zero()const;
+ bool is_zero()const;
Returns `true` is `*this` is zero, otherwise `false`.
@@ -816,7 +904,7 @@
if /scientific/ is true.
template <class T>
- T eval_convert_to()const;
+ T convert_to()const;
Provides a generic conversion mechanism to convert `*this` to type `T`. Type `T` may be any arithmetic type.
Optionally other types may also be supported by specific `Backend` types.
@@ -830,7 +918,7 @@
These functions are only available if the Backend template parameter supports runtime changes to precision. They get and set
the default precision and the precision of `*this` respectively.
- int compare(const mp_number<Backend>& o)const;
+ int compare(const mp_number<Backend, ExpressionTemplates>& o)const;
template <class V>
typename enable_if<is_arithmetic<V>, int>::type compare(const V& other)const;
@@ -876,28 +964,30 @@
In addition, one of the two arguments may be a builtin arithmetic type.
-With the exception of the comparison operators (which always evaluate their arguments and return a `bool` result),
-these operators return an "unmentionable" expression template type which defers evaluation of the operator
-until the result is actually required.
+The return type of these operators is either:
+
+* An ['unmentionable-type] expression template type when `ExpressionTemplates` is `true`.
+* Type `mp_number<Backend, false>` when `ExpressionTemplates` is `false`.
+* Type `bool` if the operator is a comparison operator.
Finally note that the second argument to the left and right shift operations must be a builtin integer type,
and that the argument must be positive (negative arguments result in a `std::runtime_error` being thrown).
[h4 swap]
- template <class Backend>
- void swap(mp_number<Backend>& a, mp_number<Backend>& b);
+ template <class Backend, ExpressionTemplates>
+ void swap(mp_number<Backend, ExpressionTemplates>& a, mp_number<Backend, ExpressionTemplates>& b);
Swaps `a` and `b`.
[h4 Iostream Support]
- template <class Backend>
- std::ostream& operator << (std::ostream& os, const mp_number<Backend>& r);
- template <class Backend>
+ template <class Backend, bool ExpressionTemplates>
+ std::ostream& operator << (std::ostream& os, const mp_number<Backend, ExpressionTemplates>& r);
+ template <class Unspecified...>
std::ostream& operator << (std::ostream& os, const unmentionable-expression-template& r);
- template <class Backend>
- inline std::istream& operator >> (std::istream& is, mp_number<Backend>& r)
+ template <class Backend, bool ExpressionTemplates>
+ inline std::istream& operator >> (std::istream& is, mp_number<Backend, ExpressionTemplates>& r)
These operators provided formatted input-output operations on `mp_number` types, and expression templates derived from them.
@@ -939,7 +1029,8 @@
``['unmentionable-expression-template-type]`` atan2 (const ``['mp_number-or-expression-template-type]``&, const ``['mp_number-or-expression-template-type]``&);
These functions all behave exactly as their standard library counterparts do: their argument is either an instance of `mp_number` or
-an expression template derived from it; their return value is always an expression template.
+an expression template derived from it; If the argument is of type `mp_number,Backend, false>` then that is also the return type,
+otherwise the return type is an expression template.
These functions are normally implemented by the Backend type. However, default versions are provided for Backend types that
don't have native support for these functions. Please note however, that this default support requires the precision of the type
@@ -990,8 +1081,8 @@
namespace std{
- template <class Backend>
- struct numeric_limits<boost::multiprecision<Backend> >
+ template <class Backend, ExpressionTemplates>
+ struct numeric_limits<boost::multiprecision<Backend, ExpressionTemplates> >
{
/* Usual members here */
};
@@ -1159,6 +1250,10 @@
[[`eval_atan2(b, cb, cb2)`][`void`][Performs the equivalent operation to `std::atan` on arguments `cb` and `cb2`, and store the result in `b`. Only required when `B` is an floating-point type.]]
]
+[note
+The non-member functions are all named with an "eval_" prefix to avoid conflicts with template classes of the same name -
+in point of fact this naming convension shouldn't be necessary, but rather works around some compiler bugs.]
+
[endsect]
[endsect]
@@ -1417,4 +1512,4 @@
[endsect]
-[endsect]
\ No newline at end of file
+[endsect]
Modified: sandbox/big_number/libs/multiprecision/test/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/test/Jamfile.v2 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -132,22 +132,8 @@
: # command line
: # input files
: # requirements
- <define>TEST_FIXED_INT1
- : test_arithmetic_fixed_int1 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_FIXED_INT2
- : test_arithmetic_fixed_int2 ;
-
-run test_arithmetic.cpp
- : # command line
- : # input files
- : # requirements
<define>TEST_CPP_INT
- : test_arithmetic_fixed_cpp_int ;
+ : test_arithmetic_cpp_int ;
run test_arithmetic.cpp
: # command line
@@ -233,13 +219,6 @@
<define>TEST_CPP_INT
: test_numeric_limits_cpp_int ;
-run test_numeric_limits.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_FIXED_INT
- : test_numeric_limits_fixed_int ;
-
run test_exp.cpp gmp
: # command line
: # input files
@@ -612,23 +591,8 @@
: # command line
: # input files
: # requirements
- <define>TEST_FIXED_INT1
- : test_int_io_fixed_int1 ;
-
-run test_int_io.cpp
- : # command line
- : # input files
- : # requirements
- <define>TEST_FIXED_INT2
- : test_int_io_fixed_int2 ;
-
-run test_fixed_int.cpp gmp
- : # command line
- : # input files
- : # requirements
- [ check-target-builds ../config//has_gmp : : <build>no ]
- release # otherwise runtime is too slow!!
- ;
+ <define>TEST_CPP_INT
+ : test_int_io_cpp_int ;
run test_cpp_int.cpp gmp
: # command line
@@ -776,6 +740,13 @@
: # command line
: # input files
: # requirements
+ <define>TEST_CPP_DEC_FLOAT_NO_ET
+ : mp_number_concept_check_cpp_dec_float_no_et ;
+
+ run mp_number_concept_check.cpp
+ : # command line
+ : # input files
+ : # requirements
<define>TEST_BACKEND
: mp_number_concept_check_backend_concept ;
Modified: sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/mp_number_concept_check.cpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -22,7 +22,7 @@
#if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) \
&& !defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR_50)\
- && !defined(TEST_MPFR_6) && !defined(TEST_MPFR_15) && !defined(TEST_MPFR_17) && !defined(TEST_MPFR_30)
+ && !defined(TEST_MPFR_6) && !defined(TEST_MPFR_15) && !defined(TEST_MPFR_17) && !defined(TEST_MPFR_30) && !defined(TEST_CPP_DEC_FLOAT_NO_ET)
# define TEST_MPF_50
# define TEST_BACKEND
# define TEST_MPZ
@@ -32,6 +32,7 @@
# define TEST_MPFR_17
# define TEST_MPFR_30
# define TEST_CPP_DEC_FLOAT
+# define TEST_CPP_DEC_FLOAT_NO_ET
#ifdef _MSC_VER
#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
@@ -48,7 +49,7 @@
#ifdef TEST_BACKEND
#include <boost/multiprecision/concepts/mp_number_architypes.hpp>
#endif
-#ifdef TEST_CPP_DEC_FLOAT
+#if defined(TEST_CPP_DEC_FLOAT) || defined(TEST_CPP_DEC_FLOAT_NO_ET)
#include <boost/multiprecision/cpp_dec_float.hpp>
#endif
#if defined(TEST_MPFR_50) || defined(TEST_MPFR_6) || defined(TEST_MPFR_15) || defined(TEST_MPFR_17) || defined(TEST_MPFR_30)
@@ -84,6 +85,9 @@
#ifdef TEST_CPP_DEC_FLOAT
instantiate(boost::multiprecision::cpp_dec_float_50());
#endif
+#ifdef TEST_CPP_DEC_FLOAT_NO_ET
+ instantiate(boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<100>, false>());
+#endif
}
int main()
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -1012,6 +1012,7 @@
#endif
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_dec_float<100>, false> >();
#endif
#ifdef TEST_MPFR
test<boost::multiprecision::mpfr_float>();
@@ -1050,6 +1051,7 @@
test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, true, void> > >();
test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, false, void> > >();
test<boost::multiprecision::cpp_rational>();
+ test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<>, false> >();
#endif
#ifdef TEST_CPP_INT_BR
test<boost::multiprecision::cpp_rational>();
Modified: sandbox/big_number/libs/multiprecision/test/test_int_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_int_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_int_io.cpp 2012-03-13 14:30:18 EDT (Tue, 13 Mar 2012)
@@ -9,11 +9,12 @@
# define _SCL_SECURE_NO_WARNINGS
#endif
-#if !defined(TEST_MPZ) && !defined(TEST_TOMMATH) && !defined(TEST_FIXED_INT1) && !defined(TEST_FIXED_INT2)
+#if !defined(TEST_MPZ) && !defined(TEST_TOMMATH) && !defined(TEST_FIXED_INT1) && !defined(TEST_FIXED_INT2) && !defined(TEST_CPP_INT)
# define TEST_TOMMATH
# define TEST_MPZ
# define TEST_FIXED_INT1
# define TEST_FIXED_INT2
+# define TEST_CPP_INT
#ifdef _MSC_VER
#pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
@@ -33,6 +34,9 @@
#if defined(TEST_FIXED_INT1) || defined(TEST_FIXED_INT2)
#include <boost/multiprecision/fixed_int.hpp>
#endif
+#ifdef TEST_CPP_INT
+#include <boost/multiprecision/cpp_int.hpp>
+#endif
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/random/mersenne_twister.hpp>
@@ -137,6 +141,11 @@
test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<20, true> > >();
test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<70, true> > >();
#endif
+#ifdef TEST_CPP_INT
+ test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<> > >();
+ test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<1024, true, void> > >();
+ test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<512, false, void> > >();
+#endif
return boost::report_errors();
}
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