|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80607 - in sandbox/big_number: boost/multiprecision boost/multiprecision/detail boost/multiprecision/detail/functions libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision/indexes libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut/ints libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-09-20 12:04:05
Author: johnmaddock
Date: 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
New Revision: 80607
URL: http://svn.boost.org/trac/boost/changeset/80607
Log:
Add traits class to determine default ExpressionTemplate parameter value.
Add support for fused-multiply-add/subtract.
Optimise temporary usage when the LHS also appears on the RHS.
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 22 ++-
sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 184 ++++++++++++++++++++++---------
sandbox/big_number/boost/multiprecision/detail/et_ops.hpp | 60 ++++++++++
sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp | 6
sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp | 22 +-
sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp | 24 ++--
sandbox/big_number/boost/multiprecision/detail/number_base.hpp | 19 ++
sandbox/big_number/boost/multiprecision/detail/number_compare.hpp | 4
sandbox/big_number/boost/multiprecision/gmp.hpp | 58 +++++++--
sandbox/big_number/boost/multiprecision/number.hpp | 60 ++++++++--
sandbox/big_number/boost/multiprecision/rational_adapter.hpp | 25 ++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 12 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 13 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 19 ++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html | 11 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html | 145 +++++++++++++-----------
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html | 229 ++++++++++++++++++++++++++++++++++++++++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_int_ref.html | 22 ++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html | 30 ++++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html | 26 ++-
sandbox/big_number/libs/multiprecision/doc/html/index.html | 2
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 116 ++++++++++++++++----
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 161 +++++++++++++++++++++++++++
sandbox/big_number/libs/multiprecision/test/test_constants.cpp | 4
sandbox/big_number/libs/multiprecision/test/test_float_io.cpp | 4
26 files changed, 1021 insertions(+), 261 deletions(-)
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-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -3059,6 +3059,12 @@
} // namespace backends;
+template <unsigned MinBits, bool Signed, bool trivial>
+struct expression_template_default<backends::cpp_int_backend<MinBits, Signed, void, trivial> >
+{
+ static const expression_template_option value = et_off;
+};
+
using boost::multiprecision::backends::cpp_int_backend;
template <unsigned MinBits, bool Signed, class Allocator, bool trivial>
@@ -3069,16 +3075,16 @@
typedef number<cpp_rational_backend> cpp_rational;
// Fixed precision unsigned types:
-typedef number<cpp_int_backend<128, false, void>, et_off> uint128_t;
-typedef number<cpp_int_backend<256, false, void>, et_off> uint256_t;
-typedef number<cpp_int_backend<512, false, void>, et_off> uint512_t;
-typedef number<cpp_int_backend<1024, false, void>, et_off> uint1024_t;
+typedef number<cpp_int_backend<128, false, void> > uint128_t;
+typedef number<cpp_int_backend<256, false, void> > uint256_t;
+typedef number<cpp_int_backend<512, false, void> > uint512_t;
+typedef number<cpp_int_backend<1024, false, void> > uint1024_t;
// Fixed precision signed types:
-typedef number<cpp_int_backend<128, true, void>, et_off> int128_t;
-typedef number<cpp_int_backend<256, true, void>, et_off> int256_t;
-typedef number<cpp_int_backend<512, true, void>, et_off> int512_t;
-typedef number<cpp_int_backend<1024, true, void>, et_off> int1024_t;
+typedef number<cpp_int_backend<128, true, void> > int128_t;
+typedef number<cpp_int_backend<256, true, void> > int256_t;
+typedef number<cpp_int_backend<512, true, void> > int512_t;
+typedef number<cpp_int_backend<1024, true, void> > int1024_t;
#ifdef BOOST_MSVC
#pragma warning(pop)
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-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -35,10 +35,16 @@
//
// Default versions of mixed arithmetic, these just construct a temporary
// from the arithmetic value and then do the arithmetic on that, two versions
-// of each depending on whether the backend can be directly constructed from type V:
+// of each depending on whether the backend can be directly constructed from type V.
+//
+// Note that we have to provide *all* the template parameters to class number when used in
+// enable_if as MSVC-10 won't compile the code if we rely on a computed-default parameter.
+// Since the result of the test doesn't depend on whether expression templates are on or off
+// we just use et_on everywhere. We could use a BOOST_WORKAROUND but that just obfuscates the
+// code even more....
//
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value >::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value >::type
eval_add(T& result, V const& v)
{
T t;
@@ -46,14 +52,14 @@
eval_add(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value >::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value >::type
eval_add(T& result, V const& v)
{
T t(v);
eval_add(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_subtract(T& result, V const& v)
{
T t;
@@ -61,14 +67,14 @@
eval_subtract(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_subtract(T& result, V const& v)
{
T t(v);
eval_subtract(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_multiply(T& result, V const& v)
{
T t;
@@ -76,14 +82,42 @@
eval_multiply(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_multiply(T& result, V const& v)
{
T t(v);
eval_multiply(result, t);
}
+
+template <class T, class U, class V>
+void eval_multiply(T& t, const U& u, const V& v);
+
+template <class T, class U, class V>
+inline typename disable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_add(T& t, const U& u, const V& v)
+{
+ T z;
+ eval_multiply(z, u, v);
+ eval_add(t, z);
+}
+template <class T, class U, class V>
+inline typename enable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_add(T& t, const U& u, const V& v)
+{
+ eval_multiply_add(t, v, u);
+}
+template <class T, class U, class V>
+inline typename disable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_subtract(T& t, const U& u, const V& v)
+{
+ T z;
+ eval_multiply(z, u, v);
+ eval_subtract(t, z);
+}
+template <class T, class U, class V>
+inline typename enable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_subtract(T& t, const U& u, const V& v)
+{
+ eval_multiply_subtract(t, v, u);
+}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_divide(T& result, V const& v)
{
T t;
@@ -91,14 +125,14 @@
eval_divide(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_divide(T& result, V const& v)
{
T t(v);
eval_divide(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_modulus(T& result, V const& v)
{
T t;
@@ -106,14 +140,14 @@
eval_modulus(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value&& is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value&& is_convertible<V, T>::value>::type
eval_modulus(T& result, V const& v)
{
T t(v);
eval_modulus(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_bitwise_and(T& result, V const& v)
{
T t;
@@ -121,14 +155,14 @@
eval_bitwise_and(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_bitwise_and(T& result, V const& v)
{
T t(v);
eval_bitwise_and(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_bitwise_or(T& result, V const& v)
{
T t;
@@ -136,14 +170,14 @@
eval_bitwise_or(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_bitwise_or(T& result, V const& v)
{
T t(v);
eval_bitwise_or(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_bitwise_xor(T& result, V const& v)
{
T t;
@@ -151,7 +185,7 @@
eval_bitwise_xor(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_bitwise_xor(T& result, V const& v)
{
T t(v);
@@ -159,7 +193,7 @@
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && !is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && !is_convertible<V, T>::value>::type
eval_complement(T& result, V const& v)
{
T t;
@@ -167,7 +201,7 @@
eval_complement(result, t);
}
template <class T, class V>
-inline typename enable_if_c<is_convertible<V, number<T> >::value && is_convertible<V, T>::value>::type
+inline typename enable_if_c<is_convertible<V, number<T, et_on> >::value && is_convertible<V, T>::value>::type
eval_complement(T& result, V const& v)
{
T t(v);
@@ -198,20 +232,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_add_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_add_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_add(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_add_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_add_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_add(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_add_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_add_default(T& t, const U& u, const T& v)
{
eval_add(t, v, u);
}
@@ -249,20 +283,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_subtract_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_subtract_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_subtract(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_subtract_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_subtract_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_subtract(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_subtract_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_subtract_default(T& t, const U& u, const T& v)
{
eval_subtract(t, v, u);
t.negate();
@@ -279,9 +313,6 @@
eval_subtract_default(t, u, v);
}
-template <class T, class U, class V>
-void eval_multiply(T& t, const U& u, const V& v);
-
template <class T>
inline void eval_multiply_default(T& t, const T& u, const T& v)
{
@@ -300,20 +331,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_multiply_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_multiply_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_multiply(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_multiply_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_multiply_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_multiply(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_multiply_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_multiply_default(T& t, const U& u, const T& v)
{
eval_multiply(t, v, u);
}
@@ -329,6 +360,47 @@
eval_multiply_default(t, u, v);
}
+template <class T, class U, class V, class X>
+inline typename disable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_add(T& t, const U& u, const V& v, const X& x)
+{
+ if((void*)&x == (void*)&t)
+ {
+ T z;
+ z = x;
+ eval_multiply_add(t, u, v, z);
+ }
+ else
+ {
+ eval_multiply(t, u, v);
+ eval_add(t, x);
+ }
+}
+template <class T, class U, class V, class X>
+inline typename enable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_add(T& t, const U& u, const V& v, const X& x)
+{
+ eval_multiply_add(t, v, u, x);
+}
+template <class T, class U, class V, class X>
+inline typename disable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_subtract(T& t, const U& u, const V& v, const X& x)
+{
+ if((void*)&x == (void*)&t)
+ {
+ T z;
+ z = x;
+ eval_multiply_subtract(t, u, v, z);
+ }
+ else
+ {
+ eval_multiply(t, u, v);
+ eval_subtract(t, x);
+ }
+}
+template <class T, class U, class V, class X>
+inline typename enable_if_c<!is_same<T, U>::value && is_same<T, V>::value>::type eval_multiply_subtract(T& t, const U& u, const V& v, const X& x)
+{
+ eval_multiply_subtract(t, v, u, x);
+}
+
template <class T, class U, class V>
void eval_divide(T& t, const U& u, const V& v);
@@ -350,27 +422,27 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_divide_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_divide_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_divide(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_divide_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_divide_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_divide(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_divide_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_divide_default(T& t, const U& u, const T& v)
{
T uu;
uu = u;
eval_divide(t, uu, v);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_divide_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_divide_default(T& t, const U& u, const T& v)
{
T uu(u);
eval_divide(t, uu, v);
@@ -408,27 +480,27 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_modulus_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_modulus_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_modulus(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_modulus_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_modulus_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_modulus(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_modulus_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_modulus_default(T& t, const U& u, const T& v)
{
T uu;
uu = u;
eval_modulus(t, uu, v);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_modulus_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_modulus_default(T& t, const U& u, const T& v)
{
T uu(u);
eval_modulus(t, uu, v);
@@ -466,20 +538,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_bitwise_and_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_bitwise_and_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_bitwise_and(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_bitwise_and_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_bitwise_and_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_bitwise_and(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_bitwise_and_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_bitwise_and_default(T& t, const U& u, const T& v)
{
eval_bitwise_and(t, v, u);
}
@@ -516,20 +588,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_bitwise_or_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_bitwise_or_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_bitwise_or(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_bitwise_or_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_bitwise_or_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_bitwise_or(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_bitwise_or_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_bitwise_or_default(T& t, const U& u, const T& v)
{
eval_bitwise_or(t, v, u);
}
@@ -566,20 +638,20 @@
}
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && !is_convertible<U, T>::value>::type eval_bitwise_xor_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && !is_convertible<U, T>::value>::type eval_bitwise_xor_default(T& t, const T& u, const U& v)
{
T vv;
vv = v;
eval_bitwise_xor(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value && is_convertible<U, T>::value>::type eval_bitwise_xor_default(T& t, const T& u, const U& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value && is_convertible<U, T>::value>::type eval_bitwise_xor_default(T& t, const T& u, const U& v)
{
T vv(v);
eval_bitwise_xor(t, u, vv);
}
template <class T, class U>
-inline typename enable_if_c<is_convertible<U, number<T> >::value>::type eval_bitwise_xor_default(T& t, const U& u, const T& v)
+inline typename enable_if_c<is_convertible<U, number<T, et_on> >::value>::type eval_bitwise_xor_default(T& t, const U& u, const T& v)
{
eval_bitwise_xor(t, v, u);
}
@@ -1272,7 +1344,7 @@
return detail::expression<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
- , number<Backend> \
+ , number<Backend, et_on> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg \
@@ -1328,8 +1400,8 @@
return detail::expression<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
- , number<Backend> \
- , number<Backend> \
+ , number<Backend, et_on> \
+ , number<Backend, et_on> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg,\
@@ -1350,7 +1422,7 @@
return detail::expression<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
- , number<Backend> \
+ , number<Backend, et_on> \
, detail::expression<tag, A1, A2, A3, A4> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
@@ -1373,7 +1445,7 @@
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, detail::expression<tag, A1, A2, A3, A4> \
- , number<Backend> \
+ , number<Backend, et_on> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg,\
@@ -1417,7 +1489,7 @@
return detail::expression<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
- , number<Backend> \
+ , number<Backend, et_on> \
, Arithmetic\
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
@@ -1464,7 +1536,7 @@
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
, Arithmetic \
- , number<Backend> \
+ , number<Backend, et_on> \
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
, arg,\
@@ -1568,7 +1640,7 @@
return detail::expression<\
detail::function\
, detail::BOOST_JOIN(func, _funct)<Backend> \
- , number<Backend> \
+ , number<Backend, et_on> \
, Arg2\
>(\
detail::BOOST_JOIN(func, _funct)<Backend>() \
Modified: sandbox/big_number/boost/multiprecision/detail/et_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/et_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/et_ops.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -77,6 +77,66 @@
return detail::expression<detail::plus, V, detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >(a, b);
}
//
+// Fused multiply add:
+//
+template <class V, class Arg1, class Arg2, class Arg3, class Arg4>
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::result_type>,
+ detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V> >::type
+ operator + (const V& a, const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& b)
+{
+ return detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V>(b.left(), b.right(), a);
+}
+template <class Arg1, class Arg2, class Arg3, class Arg4, class V>
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::result_type>,
+ detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V> >::type
+ operator + (const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
+{
+ return detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V>(a.left(), a.right(), b);
+}
+template <class B, expression_template_option ET, class Arg1, class Arg2, class Arg3, class Arg4>
+inline detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >
+ operator + (const number<B, ET>& a, const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& b)
+{
+ return detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >(b.left(), b.right(), a);
+}
+template <class Arg1, class Arg2, class Arg3, class Arg4, class B, expression_template_option ET>
+inline detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >
+ operator + (const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& a, const number<B, ET>& b)
+{
+ return detail::expression<detail::multiply_add, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >(a.left(), a.right(), b);
+}
+//
+// Fused multiply subtract:
+//
+template <class V, class Arg1, class Arg2, class Arg3, class Arg4>
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::result_type>,
+ detail::expression<detail::negate, detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V> > >::type
+ operator - (const V& a, const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& b)
+{
+ return detail::expression<detail::negate, detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V> >
+ (detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V>(b.left(), b.right(), a));
+}
+template <class Arg1, class Arg2, class Arg3, class Arg4, class V>
+inline typename enable_if<is_compatible_arithmetic_type<V, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::result_type>,
+ detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V> >::type
+ operator - (const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& a, const V& b)
+{
+ return detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, V>(a.left(), a.right(), b);
+}
+template <class B, expression_template_option ET, class Arg1, class Arg2, class Arg3, class Arg4>
+inline detail::expression<detail::negate, detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> > >
+ operator - (const number<B, ET>& a, const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& b)
+{
+ return detail::expression<detail::negate, detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> > >
+ (detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >(b.left(), b.right(), a));
+}
+template <class Arg1, class Arg2, class Arg3, class Arg4, class B, expression_template_option ET>
+inline detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >
+ operator - (const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& a, const number<B, ET>& b)
+{
+ return detail::expression<detail::multiply_subtract, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::left_type, typename detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>::right_type, number<B, ET> >(a.left(), a.right(), b);
+}
+//
// Repeat operator for negated arguments: propagate the negation to the top level to avoid temporaries:
//
template <class B, expression_template_option ET, class Arg1, class Arg2, class Arg3, class Arg4>
Modified: sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/constants.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -246,7 +246,7 @@
static bool b = false;
if(!b)
{
- calc_log2(result, boost::multiprecision::detail::digits2<number<T> >::value);
+ calc_log2(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value);
b = true;
}
@@ -262,7 +262,7 @@
static bool b = false;
if(!b)
{
- calc_e(result, boost::multiprecision::detail::digits2<number<T> >::value);
+ calc_e(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value);
b = true;
}
@@ -278,7 +278,7 @@
static bool b = false;
if(!b)
{
- calc_pi(result, boost::multiprecision::detail::digits2<number<T> >::value);
+ calc_pi(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value);
b = true;
}
Modified: sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/pow.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -90,7 +90,7 @@
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
BOOST_ASSERT(&H0F0 != &x);
- long tol = boost::multiprecision::detail::digits2<number<T> >::value;
+ long tol = boost::multiprecision::detail::digits2<number<T, et_on> >::value;
T t;
T x_pow_n_div_n_fact(x);
@@ -146,7 +146,7 @@
eval_multiply(H1F0, pochham_a, x_pow_n_div_n_fact);
eval_add(H1F0, si_type(1));
T lim;
- eval_ldexp(lim, H1F0, 1 - boost::multiprecision::detail::digits2<number<T> >::value);
+ eval_ldexp(lim, H1F0, 1 - boost::multiprecision::detail::digits2<number<T, et_on> >::value);
if(eval_get_sign(lim) < 0)
lim.negate();
@@ -154,7 +154,7 @@
T term, part;
// Series expansion of hyperg_1f0(a; ; x).
- for(n = 2; n < boost::multiprecision::detail::digits2<number<T> >::value + 10; n++)
+ for(n = 2; n < boost::multiprecision::detail::digits2<number<T, et_on> >::value + 10; n++)
{
eval_multiply(x_pow_n_div_n_fact, x);
eval_divide(x_pow_n_div_n_fact, n);
@@ -167,7 +167,7 @@
if(lim.compare(term) >= 0)
break;
}
- if(n >= boost::multiprecision::detail::digits2<number<T> >::value + 10)
+ if(n >= boost::multiprecision::detail::digits2<number<T, et_on> >::value + 10)
BOOST_THROW_EXCEPTION(std::runtime_error("H1F0 failed to converge"));
}
@@ -193,7 +193,7 @@
bool isneg = eval_get_sign(x) < 0;
if(type == FP_NAN)
{
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
}
else if(type == FP_INFINITE)
@@ -218,7 +218,7 @@
xx.negate();
// Check the range of the argument.
- static const canonical_exp_type maximum_arg_for_exp = std::numeric_limits<number<T> >::max_exponent == 0 ? (std::numeric_limits<long>::max)() : std::numeric_limits<number<T> >::max_exponent;
+ static const canonical_exp_type maximum_arg_for_exp = std::numeric_limits<number<T, et_on> >::max_exponent == 0 ? (std::numeric_limits<long>::max)() : std::numeric_limits<number<T, et_on> >::max_exponent;
if(xx.compare(maximum_arg_for_exp) >= 0)
{
@@ -226,7 +226,7 @@
if(isneg)
result = ui_type(0);
else
- result = std::numeric_limits<number<T> >::has_infinity ? std::numeric_limits<number<T> >::infinity().backend() : (std::numeric_limits<number<T> >::max)().backend();
+ result = std::numeric_limits<number<T, et_on> >::has_infinity ? std::numeric_limits<number<T, et_on> >::infinity().backend() : (std::numeric_limits<number<T, et_on> >::max)().backend();
return;
}
if(xx.compare(si_type(1)) <= 0)
@@ -234,7 +234,7 @@
//
// Use series for exp(x) - 1:
//
- T lim = std::numeric_limits<number<T> >::epsilon().backend();
+ T lim = std::numeric_limits<number<T, et_on> >::epsilon().backend();
unsigned k = 2;
exp_series = xx;
result = si_type(1);
@@ -344,7 +344,7 @@
else
eval_subtract(result, t);
- eval_multiply(lim, result, std::numeric_limits<number<T> >::epsilon().backend());
+ eval_multiply(lim, result, std::numeric_limits<number<T, et_on> >::epsilon().backend());
if(eval_get_sign(lim) < 0)
lim.negate();
INSTRUMENT_BACKEND(lim);
@@ -465,7 +465,7 @@
if((eval_get_sign(x) < 0) && !bo_a_isint)
{
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
}
T t, da;
@@ -564,7 +564,7 @@
ui_type k = 1;
T lim(x);
- eval_ldexp(lim, lim, 1 - boost::multiprecision::detail::digits2<number<T> >::value);
+ eval_ldexp(lim, lim, 1 - boost::multiprecision::detail::digits2<number<T, et_on> >::value);
do
{
Modified: sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/functions/trig.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -36,7 +36,7 @@
T tol;
tol = ui_type(1);
- eval_ldexp(tol, tol, 1 - boost::multiprecision::detail::digits2<number<T> >::value);
+ eval_ldexp(tol, tol, 1 - boost::multiprecision::detail::digits2<number<T, et_on> >::value);
eval_multiply(tol, result);
if(eval_get_sign(tol) < 0)
tol.negate();
@@ -87,7 +87,7 @@
{
case FP_INFINITE:
case FP_NAN:
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
case FP_ZERO:
result = ui_type(0);
@@ -233,7 +233,7 @@
{
case FP_INFINITE:
case FP_NAN:
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
case FP_ZERO:
result = ui_type(1);
@@ -391,7 +391,7 @@
eval_add(result, ui_type(1));
T lim;
- eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<number<T> >::value);
+ eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<number<T, et_on> >::value);
if(eval_get_sign(lim) < 0)
lim.negate();
@@ -447,7 +447,7 @@
{
case FP_NAN:
case FP_INFINITE:
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
case FP_ZERO:
result = ui_type(0);
@@ -464,7 +464,7 @@
int c = xx.compare(ui_type(1));
if(c > 0)
{
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
}
else if(c == 0)
@@ -524,7 +524,7 @@
eval_subtract(result, s);
T lim;
- eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<number<T> >::value);
+ eval_ldexp(lim, result, 1 - boost::multiprecision::detail::digits2<number<T, et_on> >::value);
if(eval_get_sign(s) < 0)
s.negate();
if(eval_get_sign(lim) < 0)
@@ -546,7 +546,7 @@
{
case FP_NAN:
case FP_INFINITE:
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
case FP_ZERO:
result = get_constant_pi<T>();
@@ -559,7 +559,7 @@
if(c > 0)
{
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
}
else if(c == 0)
@@ -591,7 +591,7 @@
switch(eval_fpclassify(x))
{
case FP_NAN:
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
return;
case FP_ZERO:
result = ui_type(0);
@@ -656,7 +656,7 @@
static const boost::int32_t double_digits10_minus_a_few = std::numeric_limits<double>::digits10 - 3;
T s, c, t;
- for(boost::int32_t digits = double_digits10_minus_a_few; digits <= std::numeric_limits<number<T> >::digits10; digits *= 2)
+ for(boost::int32_t digits = double_digits10_minus_a_few; digits <= std::numeric_limits<number<T, et_on> >::digits10; digits *= 2)
{
eval_sin(s, result);
eval_cos(c, result);
@@ -710,7 +710,7 @@
{
if(eval_fpclassify(x) == FP_INFINITE)
{
- result = std::numeric_limits<number<T> >::quiet_NaN().backend();
+ result = std::numeric_limits<number<T, et_on> >::quiet_NaN().backend();
}
else
{
Modified: sandbox/big_number/boost/multiprecision/detail/number_base.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/number_base.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/number_base.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -20,7 +20,13 @@
et_on = 1
};
-template <class Backend, expression_template_option ExpressionTemplates = et_on>
+template <class Backend>
+struct expression_template_default
+{
+ static const expression_template_option value = et_on;
+};
+
+template <class Backend, expression_template_option ExpressionTemplates = expression_template_default<Backend>::value>
class number;
template <class T>
@@ -180,6 +186,8 @@
struct bitwise_xor_immediates{};
struct complement_immediates{};
struct function{};
+struct multiply_add{};
+struct multiply_subtract{};
template <class T>
struct backend_type;
@@ -207,7 +215,14 @@
struct is_mp_number_exp<boost::multiprecision::detail::expression<Tag, Arg1, Arg2, Arg3, Arg4> > : public mpl::true_{};
template <class T1, class T2>
-struct combine_expression;
+struct combine_expression
+{
+#ifdef BOOST_NO_DECLTYPE
+ typedef typename mpl::if_c<sizeof(T1) > sizeof(T2) ? T1, T2>::type type;
+#else
+ typedef decltype(T1() + T2()) type;
+#endif
+};
template <class T1, expression_template_option ExpressionTemplates, class T2>
struct combine_expression<number<T1, ExpressionTemplates>, T2>
Modified: sandbox/big_number/boost/multiprecision/detail/number_compare.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/number_compare.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/number_compare.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -152,14 +152,14 @@
operator != (const number<Backend, ExpressionTemplates>& a, const Arithmetic& b)
{
using default_ops::eval_eq;
- return !eval_eq(a.backend(), number<Backend>::canonical_value(b));
+ return !eval_eq(a.backend(), number<Backend, et_on>::canonical_value(b));
}
template <class Arithmetic, class Backend, expression_template_option ExpressionTemplates>
inline typename enable_if_c<detail::is_valid_mixed_compare<number<Backend, ExpressionTemplates>, Arithmetic>::value, bool>::type
operator != (const Arithmetic& a, const number<Backend, ExpressionTemplates>& b)
{
using default_ops::eval_eq;
- return !eval_eq(b.backend(), number<Backend>::canonical_value(a));
+ return !eval_eq(b.backend(), number<Backend, et_on>::canonical_value(a));
}
template <class Arithmetic, class Tag, class A1, class A2, class A3, class A4>
inline typename enable_if_c<detail::is_valid_mixed_compare<typename detail::expression<Tag, A1, A2, A3, A4>::result_type, Arithmetic>::value, bool>::type
Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -1288,6 +1288,14 @@
{
mpz_add(t.data(), t.data(), o.data());
}
+inline void eval_multiply_add(gmp_int& t, const gmp_int& a, const gmp_int& b)
+{
+ mpz_addmul(t.data(), a.data(), b.data());
+}
+inline void eval_multiply_subtract(gmp_int& t, const gmp_int& a, const gmp_int& b)
+{
+ mpz_submul(t.data(), a.data(), b.data());
+}
inline void eval_subtract(gmp_int& t, const gmp_int& o)
{
mpz_sub(t.data(), t.data(), o.data());
@@ -1310,6 +1318,14 @@
{
mpz_add_ui(t.data(), t.data(), i);
}
+inline void eval_multiply_add(gmp_int& t, const gmp_int& a, unsigned long i)
+{
+ mpz_addmul_ui(t.data(), a.data(), i);
+}
+inline void eval_multiply_subtract(gmp_int& t, const gmp_int& a, unsigned long i)
+{
+ mpz_submul_ui(t.data(), a.data(), i);
+}
inline void eval_subtract(gmp_int& t, unsigned long i)
{
mpz_sub_ui(t.data(), t.data(), i);
@@ -1335,6 +1351,20 @@
else
mpz_sub_ui(t.data(), t.data(), -i);
}
+inline void eval_multiply_add(gmp_int& t, const gmp_int& a, long i)
+{
+ if(i > 0)
+ mpz_addmul_ui(t.data(), a.data(), i);
+ else
+ mpz_submul_ui(t.data(), a.data(), -i);
+}
+inline void eval_multiply_subtract(gmp_int& t, const gmp_int& a, long i)
+{
+ if(i > 0)
+ mpz_submul_ui(t.data(), a.data(), i);
+ else
+ mpz_addmul_ui(t.data(), a.data(), -i);
+}
inline void eval_subtract(gmp_int& t, long i)
{
if(i > 0)
@@ -1895,19 +1925,6 @@
{
return mpq_sgn(val.data()) == 0;
}
-inline number<gmp_int> numerator(const number<gmp_rational>& val)
-{
- number<gmp_int> result;
- mpz_set(result.backend().data(), (mpq_numref(val.backend().data())));
- return result;
-}
-inline number<gmp_int> denominator(const number<gmp_rational>& val)
-{
- number<gmp_int> result;
- mpz_set(result.backend().data(), (mpq_denref(val.backend().data())));
- return result;
-}
-
template <class T>
inline bool eval_eq(gmp_rational& a, const T& b)
{
@@ -2109,6 +2126,21 @@
typedef number<gmp_int> type;
};
+template <expression_template_option ET>
+inline number<gmp_int, ET> numerator(const number<gmp_rational, ET>& val)
+{
+ number<gmp_int, ET> result;
+ mpz_set(result.backend().data(), (mpq_numref(val.backend().data())));
+ return result;
+}
+template <expression_template_option ET>
+inline number<gmp_int, ET> denominator(const number<gmp_rational, ET>& val)
+{
+ number<gmp_int, ET> result;
+ mpz_set(result.backend().data(), (mpq_denref(val.backend().data())));
+ return result;
+}
+
#ifdef BOOST_NO_SFINAE_EXPR
namespace detail{
Modified: sandbox/big_number/boost/multiprecision/number.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/number.hpp (original)
+++ sandbox/big_number/boost/multiprecision/number.hpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -160,9 +160,9 @@
m_backend = canonical_value(v);
return *this;
}
- template <class Other>
+ template <class Other, expression_template_option ET>
typename disable_if<boost::multiprecision::detail::is_explicitly_convertible<Other, Backend>, number<Backend, ExpressionTemplates>& >::type
- assign(const number<Other>& v)
+ assign(const number<Other, ET>& v)
{
//
// Attempt a generic interconvertion:
@@ -209,6 +209,17 @@
return *this;
}
+ template <class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator+=(const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& e)
+ {
+ //
+ // Fused multiply-add:
+ //
+ using default_ops::eval_multiply_add;
+ eval_multiply_add(m_backend, canonical_value(e.left_ref()), canonical_value(e.right_ref()));
+ return *this;
+ }
+
template <class V>
typename enable_if<boost::is_convertible<V, self_type>, number<Backend, ExpressionTemplates>& >::type
operator+=(const V& v)
@@ -249,6 +260,17 @@
return *this;
}
+ template <class Arg1, class Arg2, class Arg3, class Arg4>
+ number& operator-=(const detail::expression<detail::multiply_immediates, Arg1, Arg2, Arg3, Arg4>& e)
+ {
+ //
+ // Fused multiply-subtract:
+ //
+ using default_ops::eval_multiply_subtract;
+ eval_multiply_subtract(m_backend, canonical_value(e.left_ref()), canonical_value(e.right_ref()));
+ return *this;
+ }
+
number& operator *= (const self_type& e)
{
@@ -673,6 +695,18 @@
using default_ops::eval_multiply;
eval_multiply(m_backend, canonical_value(e.left().value()), canonical_value(e.right().value()));
}
+ template <class Exp>
+ void do_assign(const Exp& e, const detail::multiply_add&)
+ {
+ using default_ops::eval_multiply_add;
+ eval_multiply_add(m_backend, canonical_value(e.left().value()), canonical_value(e.middle().value()), canonical_value(e.right().value()));
+ }
+ template <class Exp>
+ void do_assign(const Exp& e, const detail::multiply_subtract&)
+ {
+ using default_ops::eval_multiply_subtract;
+ eval_multiply_subtract(m_backend, canonical_value(e.left().value()), canonical_value(e.middle().value()), canonical_value(e.right().value()));
+ }
template <class Exp>
void do_assign(const Exp& e, const detail::divide_immediates&)
@@ -710,13 +744,13 @@
// Ignore the right node, it's *this, just add the left:
do_add(e.left(), typename left_type::tag_type());
}
- else if(bl || br)
+ else if(bl && br)
{
self_type temp(e);
temp.m_backend.swap(this->m_backend);
}
- else if(left_depth >= right_depth)
- {
+ else if(bl || (left_depth >= right_depth))
+ { // br is always false, but if bl is true we must take the this branch:
do_assign(e.left(), typename left_type::tag_type());
do_add(e.right(), typename right_type::tag_type());
}
@@ -749,13 +783,13 @@
do_subtract(e.left(), typename left_type::tag_type());
m_backend.negate();
}
- else if(bl || br)
+ else if(bl && br)
{
self_type temp(e);
temp.m_backend.swap(this->m_backend);
}
- else if(left_depth >= right_depth)
- {
+ else if(bl || (left_depth >= right_depth))
+ { // br is always false, but if bl is true we must take the this branch:
do_assign(e.left(), typename left_type::tag_type());
do_subtract(e.right(), typename right_type::tag_type());
}
@@ -788,13 +822,13 @@
// Ignore the right node, it's *this, just add the left:
do_multiplies(e.left(), typename left_type::tag_type());
}
- else if(bl || br)
+ else if(bl && br)
{
self_type temp(e);
temp.m_backend.swap(this->m_backend);
}
- else if(left_depth >= right_depth)
- {
+ else if(bl || (left_depth >= right_depth))
+ { // br is always false, but if bl is true we must take the this branch:
do_assign(e.left(), typename left_type::tag_type());
do_multiplies(e.right(), typename right_type::tag_type());
}
@@ -818,7 +852,7 @@
// Ignore the left node, it's *this, just add the right:
do_divide(e.right(), typename right_type::tag_type());
}
- else if(bl || br)
+ else if(br)
{
self_type temp(e);
temp.m_backend.swap(this->m_backend);
@@ -848,7 +882,7 @@
// Ignore the left node, it's *this, just add the right:
do_modulus(e.right(), typename right_type::tag_type());
}
- else if(bl || br)
+ else if(br)
{
self_type temp(e);
temp.m_backend.swap(this->m_backend);
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-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -213,17 +213,6 @@
return eval_get_sign(val.data().numerator().backend());
}
-template <class IntBackend>
-inline number<IntBackend> numerator(const number<rational_adapter<IntBackend> >& val)
-{
- return val.backend().data().numerator();
-}
-template <class IntBackend>
-inline number<IntBackend> denominator(const number<rational_adapter<IntBackend> >& val)
-{
- return val.backend().data().denominator();
-}
-
template<class IntBackend, class V>
inline void assign_components(rational_adapter<IntBackend>& result, const V& v1, const V& v2)
{
@@ -233,6 +222,9 @@
} // namespace backends
template<class IntBackend>
+struct expression_template_default<backends::rational_adapter<IntBackend> > : public expression_template_default<IntBackend> {};
+
+template<class IntBackend>
struct number_category<backends::rational_adapter<IntBackend> > : public mpl::int_<number_kind_rational>{};
using boost::multiprecision::backends::rational_adapter;
@@ -243,6 +235,17 @@
typedef number<T> type;
};
+template <class IntBackend, expression_template_option ET>
+inline number<IntBackend, ET> numerator(const number<rational_adapter<IntBackend>, ET>& val)
+{
+ return val.backend().data().numerator();
+}
+template <class IntBackend, expression_template_option ET>
+inline number<IntBackend, ET> denominator(const number<rational_adapter<IntBackend>, ET>& val)
+{
+ return val.backend().data().denominator();
+}
+
#ifdef BOOST_NO_SFINAE_EXPR
namespace detail{
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="../indexes.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id992722">
+<div class="section id995130">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id992722"></a>Function Index</h3></div></div></div>
+<a name="id995130"></a>Function Index</h3></div></div></div>
<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_12">P</a> <a class="link" href="s01.html#idx_id_13">R</a> <a class="link" href="s01.html#idx_id_14">S</a> <a class="link" href="s01.html#idx_id_15">T</a> <a class="link" href="s01.html#idx_id_17">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -265,6 +265,14 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">eval_multiply_add</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">eval_multiply_subtract</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">eval_pow</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
</li>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -13,10 +13,10 @@
<div class="spirit-nav">
<a accesskey="p" href="s01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id997152">
+<div class="section id998787">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id997152"></a>Class Index</h3></div></div></div>
-<p><a class="link" href="s02.html#idx_id_20">C</a> <a class="link" href="s02.html#idx_id_24">G</a> <a class="link" href="s02.html#idx_id_25">I</a> <a class="link" href="s02.html#idx_id_27">M</a> <a class="link" href="s02.html#idx_id_28">N</a> <a class="link" href="s02.html#idx_id_33">T</a></p>
+<a name="id998787"></a>Class Index</h3></div></div></div>
+<p><a class="link" href="s02.html#idx_id_20">C</a> <a class="link" href="s02.html#idx_id_22">E</a> <a class="link" href="s02.html#idx_id_24">G</a> <a class="link" href="s02.html#idx_id_25">I</a> <a class="link" href="s02.html#idx_id_27">M</a> <a class="link" href="s02.html#idx_id_28">N</a> <a class="link" href="s02.html#idx_id_33">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
<a name="idx_id_20"></a><span class="term">C</span>
@@ -33,6 +33,13 @@
</li>
</ul></div></dd>
<dt>
+<a name="idx_id_22"></a><span class="term">E</span>
+</dt>
+<dd><div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">expression_template_default</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
+</li></ul></div></dd>
+<dt>
<a name="idx_id_24"></a><span class="term">G</span>
</dt>
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id997497">
+<div class="section id999166">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id997497"></a>Typedef Index</h3></div></div></div>
+<a name="id999166"></a>Typedef Index</h3></div></div></div>
<p><a class="link" href="s03.html#idx_id_38">C</a> <a class="link" href="s03.html#idx_id_43">I</a> <a class="link" href="s03.html#idx_id_44">L</a> <a class="link" href="s03.html#idx_id_45">M</a> <a class="link" href="s03.html#idx_id_51">T</a> <a class="link" href="s03.html#idx_id_52">U</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -12,9 +12,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
</div>
-<div class="section id998231">
+<div class="section id999901">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id998231"></a>Index</h3></div></div></div>
+<a name="id999901"></a>Index</h3></div></div></div>
<p><a class="link" href="s04.html#idx_id_54">A</a> <a class="link" href="s04.html#idx_id_55">B</a> <a class="link" href="s04.html#idx_id_56">C</a> <a class="link" href="s04.html#idx_id_57">D</a> <a class="link" href="s04.html#idx_id_58">E</a> <a class="link" href="s04.html#idx_id_59">F</a> <a class="link" href="s04.html#idx_id_60">G</a> <a class="link" href="s04.html#idx_id_61">I</a> <a class="link" href="s04.html#idx_id_62">L</a> <a class="link" href="s04.html#idx_id_63">M</a> <a class="link" href="s04.html#idx_id_64">N</a> <a class="link" href="s04.html#idx_id_65">O</a> <a class="link" href="s04.html#idx_id_66">P</a> <a class="link" href="s04.html#idx_id_67">R</a> <a class="link" href="s04.html#idx_id_68">S</a> <a class="link" href="s04.html#idx_id_69">T</a> <a class="link" href="s04.html#idx_id_70">U</a> <a class="link" href="s04.html#idx_id_71">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -347,6 +347,14 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">eval_multiply_add</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">eval_multiply_subtract</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">eval_pow</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
</li>
@@ -400,6 +408,10 @@
<p><span class="index-entry-level-0">eval_trunc</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">expression_template_default</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
+</li>
</ul></div></dd>
<dt>
<a name="idx_id_59"></a><span class="term">F</span>
@@ -676,6 +688,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">component_type</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">default_precision</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">divide_qr</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">expression_template_default</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">fpclassify</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">integer_modulus</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">iround</span></a></p></li>
@@ -746,6 +759,8 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_lt</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_modulus</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_multiply</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_multiply_add</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_multiply_subtract</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_pow</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_powm</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_qr</span></a></p></li>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -44,6 +44,17 @@
Changed ExpressionTemplates parameter to class <code class="computeroutput"><span class="identifier">number</span></code>
to use enumerated values rather than true/false.
</li>
+<li class="listitem">
+ Changed ExpressionTemplate parameter default value to use a traits class
+ so that the default value depends on the backend used.
+ </li>
+<li class="listitem">
+ Added support for fused-multiply-add/subtract with GMP support.
+ </li>
+<li class="listitem">
+ Tweaked expression template unpacking to use fewer temporaries when the
+ LHS also appears in the RHS.
+ </li>
</ul></div>
<h5>
<a name="boost_multiprecision.map.hist.h1"></a>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -18,6 +18,38 @@
<a name="boost_multiprecision.map.todo"></a><a class="link" href="todo.html" title="TODO">TODO</a>
</h3></div></div></div>
<p>
+ More a list of what <span class="emphasis"><em>could</em></span> be done, rather than what
+ <span class="emphasis"><em>should</em></span> be done (which may be a much smaller list!).
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ Add back-end support for libdecNumber.
+ </li>
+<li class="listitem">
+ Add an adapter back-end for complex number types.
+ </li>
+<li class="listitem">
+ Add a back-end for MPFR interval arithmetic.
+ </li>
+<li class="listitem">
+ Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend.
+ </li>
+<li class="listitem">
+ Add assembly level routines to cpp_int_backend.
+ </li>
+<li class="listitem">
+ Add an all C++ binary floating point type.
+ </li>
+<li class="listitem">
+ Can ring types (exact floating point types) be supported? The answer
+ should be yes, but someone needs to write it, the hard part is IO and
+ binary-decimal convertion.
+ </li>
+<li class="listitem">
+ Should there be a choice of rounding mode (probably MPFR specific)?
+ </li>
+</ul></div>
+<p>
Things requested in review:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
@@ -35,15 +67,6 @@
detected by the user).
</li>
<li class="listitem">
- IIUC convert_to is used to emulate in c++98 compilers C++11 explicit
- conversions. Could the explicit conversion operator be added on compilers
- supporting it? (Done 2012/09/15).
- </li>
-<li class="listitem">
- The front-end should make the differences between implicit and explicit
- construction (Done 2012/09/15).
- </li>
-<li class="listitem">
The use of bool in template parameters could be improved by the use of
an enum class which will be more explicit. E.g <code class="computeroutput"><span class="keyword">enum</span>
<span class="keyword">class</span> <span class="identifier">expression_template</span>
@@ -51,53 +74,18 @@
<span class="special">{</span><span class="keyword">unsigned</span><span class="special">,</span> <span class="keyword">signed</span><span class="special">};</span></code> (Partly done 2012/09/15).
</li>
<li class="listitem">
- The ExpresionTemplate parameter could be defaulted to a traits class
- for more sensible defaults.
- </li>
-<li class="listitem">
- The library interface should use the noexcept (BOOST_NOEXCEPT, ...) facilities
- (Done 2012/09/15).
- </li>
-<li class="listitem">
- It is unfortunate that the generic mp_number front end can not make use
- contexpr as not all the backends can ensure this (done - we can go quite
- a way).
- </li>
-<li class="listitem">
- literals: The library doesn't provide some kind of literals. I think
- that the mp_number class should provide a way to create literals if the
- backend is able to. (Done 2012/09/15).
- </li>
-<li class="listitem">
The performances of mp_number<a_trivial_adaptor<float>, false>respect
to float and mp_number<a_trivial_adaptor<int>, false> and
int should be given to show the cost of using the generic interface (Mostly
done, just need to update docs to the latest results).
</li>
<li class="listitem">
- The documentation should contain Throws specification on the mp_number
- and backend requirements operations. (Done 2012/09/15).
- </li>
-<li class="listitem">
- The tutorial should add more examples concerning implicit or explicit
- conversions. (Done 2012/09/15).
- </li>
-<li class="listitem">
- The documentation must explain how move semantics helps in this domain
- and what the backend needs to do to profit from this optimization. (Done
- 2012/09/15).
- </li>
-<li class="listitem">
The rounding applied when converting must be documented.
</li>
<li class="listitem">
cpp_dec_float should round to nearest.
</li>
<li class="listitem">
- In a = exp1 op exp2 where a occurs inside one of exp1 or exp2 then we
- can optimise and eliminate one more temporary.
- </li>
-<li class="listitem">
We can reuse temporaries in multiple subtrees (temporary caching).
</li>
<li class="listitem">
@@ -116,29 +104,49 @@
Document why we don't abstract out addition/multiplication algorithms
etc.
</li>
-</ul></div>
-<p>
- More a list of what <span class="emphasis"><em>could</em></span> be done, rather than what
- <span class="emphasis"><em>should</em></span> be done (which may be a much smaller list!).
- </p>
-<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
- Add back-end support for libdecNumber.
+ IIUC convert_to is used to emulate in c++98 compilers C++11 explicit
+ conversions. Could the explicit conversion operator be added on compilers
+ supporting it? (Done 2012/09/15).
</li>
<li class="listitem">
- Add an adapter back-end for complex number types.
+ The front-end should make the differences between implicit and explicit
+ construction (Done 2012/09/15).
</li>
<li class="listitem">
- Add a back-end for MPFR interval arithmetic.
+ The tutorial should add more examples concerning implicit or explicit
+ conversions. (Done 2012/09/15).
</li>
<li class="listitem">
- Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend.
+ The documentation must explain how move semantics helps in this domain
+ and what the backend needs to do to profit from this optimization. (Done
+ 2012/09/15).
</li>
<li class="listitem">
- Add assembly level routines to cpp_int_backend.
+ The documentation should contain Throws specification on the mp_number
+ and backend requirements operations. (Done 2012/09/15).
</li>
<li class="listitem">
- Add an all C++ binary floating point type.
+ The library interface should use the noexcept (BOOST_NOEXCEPT, ...) facilities
+ (Done 2012/09/15).
+ </li>
+<li class="listitem">
+ It is unfortunate that the generic mp_number front end can not make use
+ contexpr as not all the backends can ensure this (done - we can go quite
+ a way).
+ </li>
+<li class="listitem">
+ literals: The library doesn't provide some kind of literals. I think
+ that the mp_number class should provide a way to create literals if the
+ backend is able to. (Done 2012/09/15).
+ </li>
+<li class="listitem">
+ The ExpresionTemplate parameter could be defaulted to a traits class
+ for more sensible defaults (done 2012/09/20).
+ </li>
+<li class="listitem">
+ In a = exp1 op exp2 where a occurs inside one of exp1 or exp2 then we
+ can optimise and eliminate one more temporary (done 2012/09/20).
</li>
</ul></div>
<h5>
@@ -148,8 +156,17 @@
</h5>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
+ Make fixed precision orthogonal to Allocator type in cpp_int. Possible
+ solution - add an additional MaxBits template argument that defaults
+ to 0 (meaning keep going till no more space/memory).
+ </li>
+<li class="listitem">
Can ring types (exact floating point types) be supported? The answer
- should be yes, but someone needs to write it.
+ should be yes, but someone needs to write it (Moved to TODO list).
+ </li>
+<li class="listitem">
+ Should there be a choice of rounding mode (probably MPFR specific)? Moved
+ to TODO list.
</li>
<li class="listitem">
Make the exponent type for cpp_dec_float a templare parameter, maybe
@@ -163,15 +180,6 @@
Document std lib function accuracy (done 2012/09/15).
</li>
<li class="listitem">
- Make fixed precision orthogonal to Allocator type in cpp_int. Possible
- solution - add an additional MaxBits template argument that defaults
- to 0 (meaning keep going till no more space/memory).
- </li>
-<li class="listitem">
- Add support for fused multiply add (and subtract). GMP mpz_t could use
- this.
- </li>
-<li class="listitem">
Be a bit clearer on the effects of sign-magnitude representation of cpp_int
- min == -max etc - done.
</li>
@@ -187,10 +195,11 @@
note 2012/09/06).
</li>
<li class="listitem">
- Should there be a choice of rounding mode (probably MPFR specific)?
+ Document limits on size of cpp_dec_float (done 2012/09/06).
</li>
<li class="listitem">
- Document limits on size of cpp_dec_float (done 2012/09/06).
+ Add support for fused multiply add (and subtract). GMP mpz_t could use
+ this (done 2012/09/20).
</li>
</ul></div>
</div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -1812,6 +1812,235 @@
<tr>
<td>
<p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">cb</span></code> by
+ <code class="computeroutput"><span class="identifier">cb2</span></code> and adds the
+ result to <code class="computeroutput"><span class="identifier">b</span></code>. When
+ not provided does the equivalent of creating a temporary <code class="computeroutput"><span class="identifier">B</span> <span class="identifier">t</span></code>
+ and <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">t</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">a</span></code> by
+ <code class="computeroutput"><span class="identifier">cb</span></code> and adds the
+ result to <code class="computeroutput"><span class="identifier">b</span></code>. The
+ type of <code class="computeroutput"><span class="identifier">a</span></code> shall
+ be listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>. When not provided
+ does the equivalent of creating a temporary <code class="computeroutput"><span class="identifier">B</span>
+ <span class="identifier">t</span></code> and <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">t</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">a</span></code> by
+ <code class="computeroutput"><span class="identifier">cb</span></code> and adds the
+ result to <code class="computeroutput"><span class="identifier">b</span></code>. The
+ type of <code class="computeroutput"><span class="identifier">a</span></code> shall
+ be listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>. When not provided
+ does the equivalent of <code class="computeroutput"><span class="identifier">eval_multiply_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">cb</span></code> by
+ <code class="computeroutput"><span class="identifier">cb2</span></code> and subtracts
+ the result from <code class="computeroutput"><span class="identifier">b</span></code>.
+ When not provided does the equivalent of creating a temporary
+ <code class="computeroutput"><span class="identifier">B</span> <span class="identifier">t</span></code>
+ and <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">t</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">a</span></code> by
+ <code class="computeroutput"><span class="identifier">cb</span></code> and subtracts
+ the result from <code class="computeroutput"><span class="identifier">b</span></code>.
+ The type of <code class="computeroutput"><span class="identifier">a</span></code> shall
+ be listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>. When not provided
+ does the equivalent of creating a temporary <code class="computeroutput"><span class="identifier">B</span>
+ <span class="identifier">t</span></code> and <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">t</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">a</span></code> by
+ <code class="computeroutput"><span class="identifier">cb</span></code> and subtracts
+ the result from <code class="computeroutput"><span class="identifier">b</span></code>.
+ The type of <code class="computeroutput"><span class="identifier">a</span></code> shall
+ be listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>. When not provided
+ does the equivalent of <code class="computeroutput"><span class="identifier">eval_multiply_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">,</span> <span class="identifier">cb3</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">cb</span></code> by
+ <code class="computeroutput"><span class="identifier">cb2</span></code> and adds the
+ result to <code class="computeroutput"><span class="identifier">cb3</span></code> storing
+ the result in <code class="computeroutput"><span class="identifier">b</span></code>.
+ When not provided does the equivalent of <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb3</span><span class="special">)</span></code>. For brevity, only a version showing
+ all arguments of type <code class="computeroutput"><span class="identifier">B</span></code>
+ is shown here, but you can replace up to any 2 of <code class="computeroutput"><span class="identifier">cb</span></code>, <code class="computeroutput"><span class="identifier">cb2</span></code>
+ and <code class="computeroutput"><span class="identifier">cb3</span></code> with any
+ type type listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_multiply_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">,</span> <span class="identifier">cb3</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Multiplies <code class="computeroutput"><span class="identifier">cb</span></code> by
+ <code class="computeroutput"><span class="identifier">cb2</span></code> and subtracts
+ from the result <code class="computeroutput"><span class="identifier">cb3</span></code>
+ storing the result in <code class="computeroutput"><span class="identifier">b</span></code>.
+ When not provided does the equivalent of <code class="computeroutput"><span class="identifier">eval_multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">,</span> <span class="identifier">cb2</span><span class="special">)</span></code> followed by <code class="computeroutput"><span class="identifier">eval_subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb3</span><span class="special">)</span></code>. For brevity, only a version showing
+ all arguments of type <code class="computeroutput"><span class="identifier">B</span></code>
+ is shown here, but you can replace up to any 2 of <code class="computeroutput"><span class="identifier">cb</span></code>, <code class="computeroutput"><span class="identifier">cb2</span></code>
+ and <code class="computeroutput"><span class="identifier">cb3</span></code> with any
+ type type listed in one of the type lists <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">signed_types</span></code>,
+ <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">unsigned_types</span></code> or <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">float_types</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+  
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
<code class="computeroutput"><span class="identifier">eval_divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
<span class="identifier">a</span><span class="special">)</span></code>
</p>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_int_ref.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_int_ref.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/cpp_int_ref.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -21,22 +21,28 @@
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinBits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Signed</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">limb_type</span><span class="special">></span> <span class="special">></span>
<span class="keyword">struct</span> <span class="identifier">cpp_int_backend</span><span class="special">;</span>
+<span class="comment">//</span>
+<span class="comment">// Expression templates default to et_off if there is no allocator:</span>
+<span class="comment">//</span>
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Signed</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">Signed</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span>
+<span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">expression_template_option</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">et_off</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_int</span><span class="special">;</span> <span class="comment">// arbitrary precision integer</span>
<span class="keyword">typedef</span> <span class="identifier">rational_adapter</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_rational_backend</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_rational_backend</span><span class="special">></span> <span class="identifier">cpp_rational</span><span class="special">;</span> <span class="comment">// arbitrary precision rational number</span>
<span class="comment">// Fixed precision unsigned types:</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint512_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint1024_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint512_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint1024_t</span><span class="special">;</span>
<span class="comment">// Fixed precision signed types:</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int512_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int1024_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int512_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int1024_t</span><span class="special">;</span>
<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -23,7 +23,12 @@
</h5>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">></span>
+<span class="keyword">enum</span> <span class="identifier">expression_template_option</span> <span class="special">{</span> <span class="identifier">et_on</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">et_off</span> <span class="special">=</span> <span class="number">0</span> <span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">></span> <span class="keyword">struct</span> <span class="identifier">expression_template_default</span>
+<span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">expression_template_option</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">et_on</span><span class="special">;</span> <span class="special">};</span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>::</span><span class="identifier">value</span><span class="special">></span>
<span class="keyword">class</span> <span class="identifier">number</span>
<span class="special">{</span>
<span class="identifier">number</span><span class="special">();</span>
@@ -206,7 +211,20 @@
<a name="boost_multiprecision.ref.number.h1"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.description"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.description">Description</a>
</h5>
-<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">></span>
+<pre class="programlisting"><span class="keyword">enum</span> <span class="identifier">expression_template_option</span> <span class="special">{</span> <span class="identifier">et_on</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">et_off</span> <span class="special">=</span> <span class="number">0</span> <span class="special">};</span>
+</pre>
+<p>
+ This enumerated type is used to specify whether expression templates are
+ turned on (et_on) or turned off (et_off).
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">></span> <span class="keyword">struct</span> <span class="identifier">expression_template_default</span>
+<span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">expression_template_option</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">et_on</span><span class="special">;</span> <span class="special">};</span>
+</pre>
+<p>
+ This traits class specifies the default expression template option to be
+ used with a particular Backend type. It defaults to <code class="computeroutput"><span class="identifier">et_on</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>::</span><span class="identifier">value</span><span class="special">></span>
<span class="keyword">class</span> <span class="identifier">number</span><span class="special">;</span>
</pre>
<p>
@@ -222,8 +240,12 @@
</p></dd>
<dt><span class="term">ExpressionTemplates</span></dt>
<dd><p>
- A Boolean value: when true, then expression templates are enabled,
- otherwise they are disabled.
+ A Boolean value: when <code class="computeroutput"><span class="identifier">et_on</span></code>,
+ then expression templates are enabled, otherwise when set to <code class="computeroutput"><span class="identifier">et_off</span></code> they are disabled. The default
+ for this parameter is computed via the traits class <code class="computeroutput"><span class="identifier">expression_template_default</span></code>
+ whose member <code class="computeroutput"><span class="identifier">value</span></code>
+ defaults to <code class="computeroutput"><span class="identifier">et_on</span></code> unless
+ the the traits class is specialized for a particular backend.
</p></dd>
</dl>
</div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -26,22 +26,28 @@
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinDigits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Signed</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">limb_type</span><span class="special">></span> <span class="special">></span>
<span class="keyword">class</span> <span class="identifier">cpp_int_backend</span><span class="special">;</span>
+<span class="comment">//</span>
+<span class="comment">// Expression templates default to et_off if there is no allocator:</span>
+<span class="comment">//</span>
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Signed</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">Signed</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span>
+<span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">expression_template_option</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">et_off</span><span class="special">;</span> <span class="special">};</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_int</span><span class="special">;</span> <span class="comment">// arbitrary precision integer</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_int</span><span class="special">;</span> <span class="comment">// arbitrary precision integer</span>
<span class="keyword">typedef</span> <span class="identifier">rational_adapter</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_rational_backend</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_rational_backend</span><span class="special">></span> <span class="identifier">cpp_rational</span><span class="special">;</span> <span class="comment">// arbitrary precision rational number</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_rational_backend</span><span class="special">></span> <span class="identifier">cpp_rational</span><span class="special">;</span> <span class="comment">// arbitrary precision rational number</span>
<span class="comment">// Fixed precision unsigned types:</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint512_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">uint1024_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint512_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">uint1024_t</span><span class="special">;</span>
<span class="comment">// Fixed precision signed types:</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int512_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">>,</span> <span class="identifier">et_off</span><span class="special">></span> <span class="identifier">int1024_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">128</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">256</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">512</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int512_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="number">1024</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="identifier">int1024_t</span><span class="special">;</span>
<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -120,7 +120,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: September 16, 2012 at 12:00:51 GMT</small></p></td>
+<td align="left"><p><small>Last revised: September 20, 2012 at 15:58:33 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
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-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -340,22 +340,28 @@
template <unsigned MinDigits = 0, bool Signed = true, class Allocator = std::allocator<limb_type> >
class cpp_int_backend;
+ //
+ // Expression templates default to et_off if there is no allocator:
+ //
+ template <unsigned MinDigits, bool Signed>
+ struct expression_template_default<cpp_int_backend<MinDigits, Signed, void> >
+ { static const expression_template_option value = et_off; };
- typedef number<cpp_int_backend<> > cpp_int; // arbitrary precision integer
+ typedef number<cpp_int_backend<> > cpp_int; // arbitrary precision integer
typedef rational_adapter<cpp_int_backend<> > cpp_rational_backend;
- typedef number<cpp_rational_backend> cpp_rational; // arbitrary precision rational number
+ typedef number<cpp_rational_backend> cpp_rational; // arbitrary precision rational number
// Fixed precision unsigned types:
- typedef number<cpp_int_backend<128, false, void>, et_off> uint128_t;
- typedef number<cpp_int_backend<256, false, void>, et_off> uint256_t;
- typedef number<cpp_int_backend<512, false, void>, et_off> uint512_t;
- typedef number<cpp_int_backend<1024, false, void>, et_off> uint1024_t;
+ typedef number<cpp_int_backend<128, false, void> > uint128_t;
+ typedef number<cpp_int_backend<256, false, void> > uint256_t;
+ typedef number<cpp_int_backend<512, false, void> > uint512_t;
+ typedef number<cpp_int_backend<1024, false, void> > uint1024_t;
// Fixed precision signed types:
- typedef number<cpp_int_backend<128, true, void>, et_off> int128_t;
- typedef number<cpp_int_backend<256, true, void>, et_off> int256_t;
- typedef number<cpp_int_backend<512, true, void>, et_off> int512_t;
- typedef number<cpp_int_backend<1024, true, void>, et_off> int1024_t;
+ typedef number<cpp_int_backend<128, true, void> > int128_t;
+ typedef number<cpp_int_backend<256, true, void> > int256_t;
+ typedef number<cpp_int_backend<512, true, void> > int512_t;
+ typedef number<cpp_int_backend<1024, true, void> > int1024_t;
}} // namespaces
@@ -1109,7 +1115,12 @@
namespace boost{ namespace multiprecision{
- template <class Backend, expression_template_option ExpressionTemplates = true>
+ enum expression_template_option { et_on = 1, et_off = 0 };
+
+ template <class Backend> struct expression_template_default
+ { static const expression_template_option value = et_on; };
+
+ template <class Backend, expression_template_option ExpressionTemplates = expression_template_default<Backend>::value>
class number
{
number();
@@ -1290,14 +1301,26 @@
[h4 Description]
- template <class Backend, expression_template_option ExpressionTemplates = true>
+ enum expression_template_option { et_on = 1, et_off = 0 };
+
+This enumerated type is used to specify whether expression templates are turned on (et_on) or turned off (et_off).
+
+ template <class Backend> struct expression_template_default
+ { static const expression_template_option value = et_on; };
+
+This traits class specifies the default expression template option to be used with a particular Backend type.
+It defaults to `et_on`.
+
+ template <class Backend, expression_template_option ExpressionTemplates = expression_template_default<Backend>::value>
class number;
Class `number` has two template arguments:
[variablelist
[[Backend][The actual arithmetic back-end that does all the work.]]
-[[ExpressionTemplates][A Boolean value: when true, then expression templates are enabled, otherwise they are disabled.]]
+[[ExpressionTemplates][A Boolean value: when `et_on`, then expression templates are enabled, otherwise when set to `et_off` they are disabled.
+ The default for this parameter is computed via the traits class `expression_template_default` whose member `value` defaults to `et_on` unless
+ the the traits class is specialized for a particular backend.]]
]
number();
@@ -1698,22 +1721,28 @@
template <unsigned MinBits = 0, bool Signed = true, class Allocator = std::allocator<limb_type> >
struct cpp_int_backend;
+ //
+ // Expression templates default to et_off if there is no allocator:
+ //
+ template <unsigned MinDigits, bool Signed>
+ struct expression_template_default<cpp_int_backend<MinDigits, Signed, void> >
+ { static const expression_template_option value = et_off; };
typedef number<cpp_int_backend<> > cpp_int; // arbitrary precision integer
typedef rational_adapter<cpp_int_backend<> > cpp_rational_backend;
typedef number<cpp_rational_backend> cpp_rational; // arbitrary precision rational number
// Fixed precision unsigned types:
- typedef number<cpp_int_backend<128, false, void>, et_off> uint128_t;
- typedef number<cpp_int_backend<256, false, void>, et_off> uint256_t;
- typedef number<cpp_int_backend<512, false, void>, et_off> uint512_t;
- typedef number<cpp_int_backend<1024, false, void>, et_off> uint1024_t;
+ typedef number<cpp_int_backend<128, false, void> > uint128_t;
+ typedef number<cpp_int_backend<256, false, void> > uint256_t;
+ typedef number<cpp_int_backend<512, false, void> > uint512_t;
+ typedef number<cpp_int_backend<1024, false, void> > uint1024_t;
// Fixed precision signed types:
- typedef number<cpp_int_backend<128, true, void>, et_off> int128_t;
- typedef number<cpp_int_backend<256, true, void>, et_off> int256_t;
- typedef number<cpp_int_backend<512, true, void>, et_off> int512_t;
- typedef number<cpp_int_backend<1024, true, void>, et_off> int1024_t;
+ typedef number<cpp_int_backend<128, true, void> > int128_t;
+ typedef number<cpp_int_backend<256, true, void> > int256_t;
+ typedef number<cpp_int_backend<512, true, void> > int512_t;
+ typedef number<cpp_int_backend<1024, true, void> > int1024_t;
}} // namespaces
@@ -2080,6 +2109,42 @@
[[`eval_multiply(b, a, cb)`][`void`][Multiplies `a` by `cb` and stores the result in `b`. The type of `a` shall be listed in one of the type lists
`B::signed_types`, `B::unsigned_types` or `B::float_types`.
When not provided, does the equivalent of `eval_multiply(b, cb, a)`.][[space]]]
+[[`eval_multiply_add(b, cb, cb2)`][`void`][Multiplies `cb` by `cb2` and adds the result to `b`.
+ When not provided does the equivalent of creating a temporary `B t` and `eval_multiply(t, cb, cb2)` followed by
+ `eval_add(b, t)`.][[space]]]
+[[`eval_multiply_add(b, cb, a)`][`void`][Multiplies `a` by `cb` and adds the result to `b`.
+ The type of `a` shall be listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.
+ When not provided does the equivalent of creating a temporary `B t` and `eval_multiply(t, cb, a)` followed by
+ `eval_add(b, t)`.][[space]]]
+[[`eval_multiply_add(b, a, cb)`][`void`][Multiplies `a` by `cb` and adds the result to `b`.
+ The type of `a` shall be listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.
+ When not provided does the equivalent of `eval_multiply_add(b, cb, a)`.][[space]]]
+[[`eval_multiply_subtract(b, cb, cb2)`][`void`][Multiplies `cb` by `cb2` and subtracts the result from `b`.
+ When not provided does the equivalent of creating a temporary `B t` and `eval_multiply(t, cb, cb2)` followed by
+ `eval_subtract(b, t)`.][[space]]]
+[[`eval_multiply_subtract(b, cb, a)`][`void`][Multiplies `a` by `cb` and subtracts the result from `b`.
+ The type of `a` shall be listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.
+ When not provided does the equivalent of creating a temporary `B t` and `eval_multiply(t, cb, a)` followed by
+ `eval_subtract(b, t)`.][[space]]]
+[[`eval_multiply_subtract(b, a, cb)`][`void`][Multiplies `a` by `cb` and subtracts the result from `b`.
+ The type of `a` shall be listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.
+ When not provided does the equivalent of `eval_multiply_subtract(b, cb, a)`.][[space]]]
+[[`eval_multiply_add(b, cb, cb2, cb3)`][`void`][Multiplies `cb` by `cb2` and adds the result to `cb3` storing the result in `b`.
+ When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by
+ `eval_add(b, cb3)`.
+ For brevity, only a version showing all arguments of type `B` is shown here, but you can replace up to any 2 of
+ `cb`, `cb2` and `cb3` with any type type listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]]
+[[`eval_multiply_subtract(b, cb, cb2, cb3)`][`void`][Multiplies `cb` by `cb2` and subtracts from the result `cb3` storing the result in `b`.
+ When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by
+ `eval_subtract(b, cb3)`.
+ For brevity, only a version showing all arguments of type `B` is shown here, but you can replace up to any 2 of
+ `cb`, `cb2` and `cb3` with any type type listed in one of the type lists
+ `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]]
[[`eval_divide(b, a)`][`void`][Divides `b` by `a`. The type of `a` shall be listed in one of the type lists
`B::signed_types`, `B::unsigned_types` or `B::float_types`.
When not provided, the default version calls `eval_divide(b, B(a))`]
@@ -2665,6 +2730,9 @@
* Removed "mp_" prefix from types.
* Allowed mixed precision arithmetic.
* Changed ExpressionTemplates parameter to class `number` to use enumerated values rather than true/false.
+* Changed ExpressionTemplate parameter default value to use a traits class so that the default value depends on the backend used.
+* Added support for fused-multiply-add/subtract with GMP support.
+* Tweaked expression template unpacking to use fewer temporaries when the LHS also appears in the RHS.
[h4 Pre-review history]
@@ -2706,13 +2774,11 @@
* The use of bool in template parameters could be improved by the use of
an enum class which will be more explicit. E.g `enum class expression_template {disabled, enabled};
enum class sign {unsigned, signed};` (Partly done 2012/09/15).
-* The ExpresionTemplate parameter could be defaulted to a traits class for more sensible defaults.
* The performances of mp_number<a_trivial_adaptor<float>, false>respect to
float and mp_number<a_trivial_adaptor<int>, false> and int should be
given to show the cost of using the generic interface (Mostly done, just need to update docs to the latest results).
* The rounding applied when converting must be documented.
* cpp_dec_float should round to nearest.
-* In a = exp1 op exp2 where a occurs inside one of exp1 or exp2 then we can optimise and eliminate one more temporary.
* We can reuse temporaries in multiple subtrees (temporary caching).
* Emphasise in the docs that ET's may reorder operations.
* Document why we don't use proto (compile times).
@@ -2737,6 +2803,8 @@
* literals: The library doesn't provide some kind of literals. I think that the
mp_number class should provide a way to create literals if the backend
is able to. (Done 2012/09/15).
+* The ExpresionTemplate parameter could be defaulted to a traits class for more sensible defaults (done 2012/09/20).
+* In a = exp1 op exp2 where a occurs inside one of exp1 or exp2 then we can optimise and eliminate one more temporary (done 2012/09/20).
@@ -2744,7 +2812,6 @@
* Make fixed precision orthogonal to Allocator type in cpp_int. Possible solution - add an additional MaxBits
template argument that defaults to 0 (meaning keep going till no more space/memory).
-* Add support for fused multiply add (and subtract). GMP mpz_t could use this.
* Can ring types (exact floating point types) be supported? The answer should be yes, but someone needs to write it (Moved to TODO list).
* Should there be a choice of rounding mode (probably MPFR specific)? Moved to TODO list.
* Make the exponent type for cpp_dec_float a templare parameter, maybe include support for big-integer exponents.
@@ -2756,6 +2823,7 @@
* Can we be clearer in the docs that mixed arithmetic doesn't work (no longer applicable as of 2012/09/06)?
* Document round functions behaviour better (they behave as in C++11) (added note 2012/09/06).
* Document limits on size of cpp_dec_float (done 2012/09/06).
+* Add support for fused multiply add (and subtract). GMP mpz_t could use this (done 2012/09/20).
[endsect]
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-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -1085,6 +1085,79 @@
BOOST_TEST(c == 30);
c = static_cast<cast_type>(n4) * a;
BOOST_TEST(c == 50 * 20);
+
+ n1 = -2;
+ n2 = -3;
+ n3 = -4;
+ a = static_cast<cast_type>(n1);
+ b = static_cast<cast_type>(n2);
+ c = static_cast<cast_type>(n3);
+ d = a + b * c;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + b * c;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = a + static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = a + b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == -2 + -3 * -4);
+ a += static_cast<cast_type>(n2) * c;
+ BOOST_TEST(a == -2 + -3 * -4);
+ a = static_cast<cast_type>(n1);
+ a += b * static_cast<cast_type>(n3);
+ BOOST_TEST(a == -2 + -3 * -4);
+ a = static_cast<cast_type>(n1);
+
+ d = b * c + a;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = b * c + static_cast<cast_type>(n1);
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = static_cast<cast_type>(n2) * c + a;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = b * static_cast<cast_type>(n3) + a;
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
+ BOOST_TEST(d == -2 + -3 * -4);
+ d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
+ BOOST_TEST(d == -2 + -3 * -4);
+
+ a = -20;
+ d = a - b * c;
+ BOOST_TEST(d == -20 - -3 * -4);
+ n1 = -20;
+ d = static_cast<cast_type>(n1) - b * c;
+ BOOST_TEST(d == -20 - -3 * -4);
+ d = a - static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == -20 - -3 * -4);
+ d = a - b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == -20 - -3 * -4);
+ d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == -20 - -3 * -4);
+ d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == -20 - -3 * -4);
+ a -= static_cast<cast_type>(n2) * c;
+ BOOST_TEST(a == -20 - -3 * -4);
+ a = static_cast<cast_type>(n1);
+ a -= b * static_cast<cast_type>(n3);
+ BOOST_TEST(a == -20 - -3 * -4);
+
+ a = -2;
+ d = b * c - a;
+ BOOST_TEST(d == -3 * -4 - -2);
+ n1 = -2;
+ d = b * c - static_cast<cast_type>(n1);
+ BOOST_TEST(d == -3 * -4 - -2);
+ d = static_cast<cast_type>(n2) * c - a;
+ BOOST_TEST(d == -3 * -4 - -2);
+ d = b * static_cast<cast_type>(n3) - a;
+ BOOST_TEST(d == -3 * -4 - -2);
+ d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
+ BOOST_TEST(d == -3 * -4 - -2);
+ d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
+ BOOST_TEST(d == -3 * -4 - -2);
}
template <class Real, class Num>
@@ -1209,6 +1282,77 @@
r = static_cast<cast_type>(4 * n4) / Real(4);
BOOST_TEST(r == static_cast<cast_type>(n4));
test_negative_mixed<Real, Num>(boost::mpl::bool_<std::numeric_limits<Num>::is_signed>());
+
+ n1 = 2;
+ n2 = 3;
+ n3 = 4;
+ Real a(n1), b(n2), c(n3), d;
+ d = a + b * c;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + b * c;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = a + static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = a + b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = static_cast<cast_type>(n1) + b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == 2 + 3 * 4);
+ a += static_cast<cast_type>(n2) * c;
+ BOOST_TEST(a == 2 + 3 * 4);
+ a = static_cast<cast_type>(n1);
+ a += b * static_cast<cast_type>(n3);
+ BOOST_TEST(a == 2 + 3 * 4);
+ a = static_cast<cast_type>(n1);
+
+ d = b * c + a;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = b * c + static_cast<cast_type>(n1);
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = static_cast<cast_type>(n2) * c + a;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = b * static_cast<cast_type>(n3) + a;
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = static_cast<cast_type>(n2) * c + static_cast<cast_type>(n1);
+ BOOST_TEST(d == 2 + 3 * 4);
+ d = b * static_cast<cast_type>(n3) + static_cast<cast_type>(n1);
+ BOOST_TEST(d == 2 + 3 * 4);
+
+ a = 20;
+ d = a - b * c;
+ BOOST_TEST(d == 20 - 3 * 4);
+ n1 = 20;
+ d = static_cast<cast_type>(n1) - b * c;
+ BOOST_TEST(d == 20 - 3 * 4);
+ d = a - static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == 20 - 3 * 4);
+ d = a - b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == 20 - 3 * 4);
+ d = static_cast<cast_type>(n1) - static_cast<cast_type>(n2) * c;
+ BOOST_TEST(d == 20 - 3 * 4);
+ d = static_cast<cast_type>(n1) - b * static_cast<cast_type>(n3);
+ BOOST_TEST(d == 20 - 3 * 4);
+ a -= static_cast<cast_type>(n2) * c;
+ BOOST_TEST(a == 20 - 3 * 4);
+ a = static_cast<cast_type>(n1);
+ a -= b * static_cast<cast_type>(n3);
+ BOOST_TEST(a == 20 - 3 * 4);
+
+ a = 2;
+ d = b * c - a;
+ BOOST_TEST(d == 3 * 4 - 2);
+ n1 = 2;
+ d = b * c - static_cast<cast_type>(n1);
+ BOOST_TEST(d == 3 * 4 - 2);
+ d = static_cast<cast_type>(n2) * c - a;
+ BOOST_TEST(d == 3 * 4 - 2);
+ d = b * static_cast<cast_type>(n3) - a;
+ BOOST_TEST(d == 3 * 4 - a);
+ d = static_cast<cast_type>(n2) * c - static_cast<cast_type>(n1);
+ BOOST_TEST(d == 3 * 4 - 2);
+ d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
+ BOOST_TEST(d == 3 * 4 - 2);
}
template <class Real>
@@ -1612,6 +1756,19 @@
BOOST_TEST(c == 20 * 30 + 22);
c = 22 + (a * b);
BOOST_TEST(c == 20 * 30 + 22);
+ c = 10;
+ ac = a + b * c;
+ BOOST_TEST(ac == 20 + 30 * 10);
+ ac = b * c + a;
+ BOOST_TEST(ac == 20 + 30 * 10);
+ a = a + b * c;
+ BOOST_TEST(a == 20 + 30 * 10);
+ a = 20;
+ b = a + b * c;
+ BOOST_TEST(b == 20 + 30 * 10);
+ b = 30;
+ c = a + b * c;
+ BOOST_TEST(c == 20 + 30 * 10);
//
// Test conditionals:
@@ -1681,8 +1838,8 @@
#endif
#ifdef TEST_CPP_INT_3
// Again with "trivial" backends:
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, true, void>, boost::multiprecision::et_off > >();
- test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, false, void>, boost::multiprecision::et_off > >();
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, true, void> > >();
+ test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, false, void> > >();
#endif
#ifdef TEST_CPP_INT_BR
test<boost::rational<boost::multiprecision::cpp_int> >();
Modified: sandbox/big_number/libs/multiprecision/test/test_constants.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_constants.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_constants.cpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -159,8 +159,8 @@
return false;
}
#if defined(TEST_MPFR_50)
-template <unsigned N>
-inline bool is_mpfr(const boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<N> >&)
+template <unsigned N, boost::multiprecision::expression_template_option ET>
+inline bool is_mpfr(const boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<N>, ET>&)
{
return true;
}
Modified: sandbox/big_number/libs/multiprecision/test/test_float_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_float_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_float_io.cpp 2012-09-20 12:04:02 EDT (Thu, 20 Sep 2012)
@@ -41,8 +41,8 @@
#include <iomanip>
#if defined(TEST_MPF_50)
-template <unsigned N>
-bool is_mpf(const boost::multiprecision::number<boost::multiprecision::gmp_float<N> >&)
+template <unsigned N, boost::multiprecision::expression_template_option ET>
+bool is_mpf(const boost::multiprecision::number<boost::multiprecision::gmp_float<N>, ET>&)
{ return true; }
#endif
template <class T>
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