Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77583 - in sandbox/big_number: boost/multiprecision boost/multiprecision/detail libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/perf libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-03-27 07:45:04


Author: johnmaddock
Date: 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
New Revision: 77583
URL: http://svn.boost.org/trac/boost/changeset/77583

Log:
Add a few more integer specific bit-fiddling functions.
Fix some bugs in cpp_int left shift code.
Document some missing backend API's, and update docs.
Text files modified:
   sandbox/big_number/boost/multiprecision/cpp_int.hpp | 74 +++++++++++++++++++++--
   sandbox/big_number/boost/multiprecision/detail/default_ops.hpp | 65 ++++++++++++++++++++
   sandbox/big_number/boost/multiprecision/gmp.hpp | 25 +++++++
   sandbox/big_number/boost/multiprecision/integer_ops.hpp | 63 ++++++++++++++++++++
   sandbox/big_number/boost/multiprecision/tommath.hpp | 5 +
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html | 14 ++++
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/float_performance.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/int_real_world.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/integer_performance.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/rational_performance.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/realworld.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html | 126 +++++++++++++++++++++++++++++++++++++--
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html | 44 +++++++++++++
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/primetest.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html | 2
   sandbox/big_number/libs/multiprecision/doc/html/index.html | 9 +
   sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 54 +++++++++++++++-
   sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 14 ++++
   sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp | 9 ++
   28 files changed, 494 insertions(+), 40 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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -1844,7 +1844,7 @@
    if((ors == 1) && (!*result.limbs()))
       return; // shifting zero yields zero.
    unsigned rs = ors;
- if(shift && (result.limbs()[rs - 1] >> (cpp_int_backend<MinBits, Signed, void>::limb_bits - shift)))
+ if(shift && (result.limbs()[ors - 1] >> (cpp_int_backend<MinBits, Signed, void>::limb_bits - shift)))
       ++rs; // Most significant limb will overflow when shifted
    rs += offset;
    result.resize(rs);
@@ -1860,7 +1860,7 @@
       i = 0;
       if(!truncated)
       {
- if(rs > ors)
+ if(rs > ors + offset)
          {
             pr[rs - 1 - i] = pr[ors - 1 - i] >> (cpp_int_backend<MinBits, Signed, void>::limb_bits - shift);
             --rs;
@@ -1925,7 +1925,7 @@
    {
       // This code only works when shift is non-zero, otherwise we invoke undefined behaviour!
       i = 0;
- if(rs > ors)
+ if(rs > ors + offset)
       {
          pr[rs - 1 - i] = pr[ors - 1 - i] >> (cpp_int_backend<MinBits, Signed, Allocator>::limb_bits - shift);
          --rs;
@@ -2066,7 +2066,7 @@
 // Get the location of the least-significant-bit:
 //
 template <unsigned MinBits, bool Signed, class Allocator>
-inline unsigned get_lsb(const cpp_int_backend<MinBits, Signed, Allocator>& a)
+inline unsigned eval_lsb(const cpp_int_backend<MinBits, Signed, Allocator>& a)
 {
    BOOST_ASSERT(eval_get_sign(a) != 0);
    
@@ -2123,8 +2123,8 @@
    /* Let shift := lg K, where K is the greatest power of 2
    dividing both u and v. */
 
- unsigned us = get_lsb(u);
- unsigned vs = get_lsb(v);
+ unsigned us = eval_lsb(u);
+ unsigned vs = eval_lsb(v);
    shift = (std::min)(us, vs);
    eval_right_shift(u, us);
    eval_right_shift(v, vs);
@@ -2139,7 +2139,7 @@
       // Termination condition tries not to do a full compare if possible:
       if(!v.limbs()[0] && eval_is_zero(v))
          break;
- vs = get_lsb(v);
+ vs = eval_lsb(v);
       eval_right_shift(v, vs);
       BOOST_ASSERT((v.limbs()[0] & 1));
       BOOST_ASSERT((u.limbs()[0] & 1));
@@ -2151,6 +2151,66 @@
 }
 
 template <unsigned MinBits, bool Signed, class Allocator>
+inline bool eval_bit_test(const cpp_int_backend<MinBits, Signed, Allocator>& val, unsigned index)
+{
+ unsigned offset = index / cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ unsigned shift = index % cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ limb_type mask = shift ? limb_type(1u) << shift : limb_type(1u);
+ if(offset >= val.size())
+ return false;
+ return val.limbs()[offset] & mask ? true : false;
+}
+
+template <unsigned MinBits, bool Signed, class Allocator>
+inline void eval_bit_set(cpp_int_backend<MinBits, Signed, Allocator>& val, unsigned index)
+{
+ unsigned offset = index / cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ unsigned shift = index % cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ limb_type mask = shift ? limb_type(1u) << shift : limb_type(1u);
+ if(offset >= val.size())
+ {
+ unsigned os = val.size();
+ val.resize(offset + 1);
+ if(offset >= val.size())
+ return; // fixed precision overflow
+ for(unsigned i = os; i <= offset; ++i)
+ val.limbs()[i] = 0;
+ }
+ val.limbs()[offset] |= mask;
+}
+
+template <unsigned MinBits, bool Signed, class Allocator>
+inline void eval_bit_unset(cpp_int_backend<MinBits, Signed, Allocator>& val, unsigned index)
+{
+ unsigned offset = index / cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ unsigned shift = index % cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ limb_type mask = shift ? limb_type(1u) << shift : limb_type(1u);
+ if(offset >= val.size())
+ return;
+ val.limbs()[offset] &= ~mask;
+ val.normalize();
+}
+
+template <unsigned MinBits, bool Signed, class Allocator>
+inline void eval_bit_flip(cpp_int_backend<MinBits, Signed, Allocator>& val, unsigned index)
+{
+ unsigned offset = index / cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ unsigned shift = index % cpp_int_backend<MinBits, Signed, Allocator>::limb_bits;
+ limb_type mask = shift ? limb_type(1u) << shift : limb_type(1u);
+ if(offset >= val.size())
+ {
+ unsigned os = val.size();
+ val.resize(offset + 1);
+ if(offset >= val.size())
+ return; // fixed precision overflow
+ for(unsigned i = os; i <= offset; ++i)
+ val.limbs()[i] = 0;
+ }
+ val.limbs()[offset] ^= mask;
+ val.normalize();
+}
+
+template <unsigned MinBits, bool Signed, class Allocator>
 inline void eval_lcm(cpp_int_backend<MinBits, Signed, Allocator>& result, const cpp_int_backend<MinBits, Signed, Allocator>& a, const cpp_int_backend<MinBits, Signed, Allocator>& b)
 {
    cpp_int_backend<MinBits, Signed, Allocator> t;

Modified: sandbox/big_number/boost/multiprecision/detail/default_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/detail/default_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/detail/default_ops.hpp 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -506,6 +506,71 @@
    eval_lcm(result, b, a);
 }
 
+template <class T>
+inline unsigned eval_lsb(const T& val)
+{
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ unsigned result = 0;
+ T mask, t;
+ mask = ui_type(1);
+ do
+ {
+ eval_bitwise_and(t, mask, val);
+ ++result;
+ eval_left_shift(mask, 1);
+ }
+ while(eval_is_zero(t));
+
+ return --result;
+}
+
+template <class T>
+inline bool eval_bit_test(const T& val, unsigned index)
+{
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ unsigned result = 0;
+ T mask, t;
+ mask = ui_type(1);
+ eval_left_shift(mask, index);
+ eval_bitwise_and(t, mask, val);
+ return !eval_is_zero(t);
+}
+
+template <class T>
+inline void eval_bit_set(T& val, unsigned index)
+{
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ unsigned result = 0;
+ T mask;
+ mask = ui_type(1);
+ eval_left_shift(mask, index);
+ eval_bitwise_or(val, mask);
+}
+
+template <class T>
+inline void eval_bit_flip(T& val, unsigned index)
+{
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ unsigned result = 0;
+ T mask;
+ mask = ui_type(1);
+ eval_left_shift(mask, index);
+ eval_bitwise_xor(val, mask);
+}
+
+template <class T>
+inline void eval_bit_unset(T& val, unsigned index)
+{
+ typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
+ unsigned result = 0;
+ T mask, t;
+ mask = ui_type(1);
+ eval_left_shift(mask, index);
+ eval_bitwise_and(t, mask, val);
+ if(!eval_is_zero(t))
+ eval_bitwise_xor(val, mask);
+}
+
 //
 // These have to implemented by the backend, declared here so that our macro generated code compiles OK.
 //

Modified: sandbox/big_number/boost/multiprecision/gmp.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/gmp.hpp (original)
+++ sandbox/big_number/boost/multiprecision/gmp.hpp 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -1356,6 +1356,31 @@
    mpz_lcm_ui(result.data(), a.data(), std::abs(b));
 }
 
+inline unsigned eval_lsb(const gmp_int& val)
+{
+ return mpz_scan1(val.data(), 0);
+}
+
+inline bool eval_bit_test(const gmp_int& val, unsigned index)
+{
+ return mpz_tstbit(val.data(), index) ? true : false;
+}
+
+inline void eval_bit_set(gmp_int& val, unsigned index)
+{
+ mpz_setbit(val.data(), index);
+}
+
+inline void eval_bit_unset(gmp_int& val, unsigned index)
+{
+ mpz_clrbit(val.data(), index);
+}
+
+inline void eval_bit_flip(gmp_int& val, unsigned index)
+{
+ mpz_combit(val.data(), index);
+}
+
 inline void eval_qr(const gmp_int& x, const gmp_int& y,
    gmp_int& q, gmp_int& r)
 {

Modified: sandbox/big_number/boost/multiprecision/integer_ops.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/integer_ops.hpp (original)
+++ sandbox/big_number/boost/multiprecision/integer_ops.hpp 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -89,6 +89,69 @@
    return integer_modulus(result_type(x), val);
 }
 
+template <class Backend, bool ExpressionTemplates>
+inline typename enable_if_c<number_category<Backend>::value == number_kind_integer, unsigned>::type
+ lsb(const mp_number<Backend, ExpressionTemplates>& x)
+{
+ using default_ops::eval_lsb;
+ return eval_lsb(x.backend());
+}
+
+template <class tag, class A1, class A2, class A3>
+inline typename enable_if_c<number_category<typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type>::value == number_kind_integer, unsigned>::type
+ lsb(const multiprecision::detail::mp_exp<tag, A1, A2, A3>& x)
+{
+ typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type number_type;
+ number_type n(x);
+ using default_ops::eval_lsb;
+ return eval_lsb(n.backend());
+}
+
+template <class Backend, bool ExpressionTemplates>
+inline typename enable_if_c<number_category<Backend>::value == number_kind_integer, bool>::type
+ bit_test(const mp_number<Backend, ExpressionTemplates>& x, unsigned index)
+{
+ using default_ops::eval_bit_test;
+ return eval_bit_test(x.backend(), index);
+}
+
+template <class tag, class A1, class A2, class A3>
+inline typename enable_if_c<number_category<typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type>::value == number_kind_integer, bool>::type
+ bit_test(const multiprecision::detail::mp_exp<tag, A1, A2, A3>& x, unsigned index)
+{
+ typedef typename multiprecision::detail::mp_exp<tag, A1, A2, A3>::result_type number_type;
+ number_type n(x);
+ using default_ops::eval_bit_test;
+ return eval_bit_test(n.backend(), index);
+}
+
+template <class Backend, bool ExpressionTemplates>
+inline typename enable_if_c<number_category<Backend>::value == number_kind_integer, mp_number<Backend, ExpressionTemplates>&>::type
+ bit_set(mp_number<Backend, ExpressionTemplates>& x, unsigned index)
+{
+ using default_ops::eval_bit_set;
+ eval_bit_set(x.backend(), index);
+ return x;
+}
+
+template <class Backend, bool ExpressionTemplates>
+inline typename enable_if_c<number_category<Backend>::value == number_kind_integer, mp_number<Backend, ExpressionTemplates>&>::type
+ bit_unset(mp_number<Backend, ExpressionTemplates>& x, unsigned index)
+{
+ using default_ops::eval_bit_unset;
+ eval_bit_unset(x.backend(), index);
+ return x;
+}
+
+template <class Backend, bool ExpressionTemplates>
+inline typename enable_if_c<number_category<Backend>::value == number_kind_integer, mp_number<Backend, ExpressionTemplates>&>::type
+ bit_flip(mp_number<Backend, ExpressionTemplates>& x, unsigned index)
+{
+ using default_ops::eval_bit_flip;
+ eval_bit_flip(x.backend(), index);
+ return x;
+}
+
 }} //namespaces
 
 #endif

Modified: sandbox/big_number/boost/multiprecision/tommath.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/tommath.hpp (original)
+++ sandbox/big_number/boost/multiprecision/tommath.hpp 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -449,6 +449,11 @@
    detail::check_tommath_result(mp_div(const_cast< ::mp_int*>(&x.data()), const_cast< ::mp_int*>(&y.data()), &q.data(), &r.data()));
 }
 
+inline unsigned eval_lsb(const tommath_int& val)
+{
+ return mp_cnt_lsb(const_cast<::mp_int*>(&val.data()));
+}
+
 template <class Integer>
 inline typename enable_if<is_unsigned<Integer>, Integer>::type eval_integer_modulus(const tommath_int& x, Integer val)
 {

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -492,7 +492,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -24,7 +24,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -18,7 +18,7 @@
 </h3></div></div></div></div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -27,11 +27,23 @@
 <li class="listitem">
             Add an adapter backend for complex number types.
           </li>
+<li class="listitem">
+ Add a backend 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>
 </ul></div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -32,7 +32,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/float_performance.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/float_performance.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/float_performance.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -947,7 +947,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/int_real_world.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/int_real_world.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/int_real_world.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -91,7 +91,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/integer_performance.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/integer_performance.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/integer_performance.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -3020,7 +3020,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/rational_performance.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/rational_performance.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/rational_performance.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -891,7 +891,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/realworld.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/realworld.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/perf/realworld.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -264,7 +264,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -24,7 +24,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -26,13 +26,16 @@
 <p>
         In the following tables, type B is the <code class="computeroutput"><span class="identifier">Backend</span></code>
         template arument to <code class="computeroutput"><span class="identifier">mp_number</span></code>,
- <code class="computeroutput"><span class="identifier">b</span></code> is a variable of B, <code class="computeroutput"><span class="identifier">cb</span></code> and <code class="computeroutput"><span class="identifier">cb2</span></code>
- are constant variables of type B, <code class="computeroutput"><span class="identifier">a</span></code>
- is a variable of Arithmetic type, <code class="computeroutput"><span class="identifier">s</span></code>
- is a variable of type <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span></code>, <code class="computeroutput"><span class="identifier">ui</span></code> is a variable of type <code class="computeroutput"><span class="keyword">unsigned</span></code>, <code class="computeroutput"><span class="identifier">bb</span></code>
- is a variable of type <code class="computeroutput"><span class="keyword">bool</span></code>,
- <code class="computeroutput"><span class="identifier">pa</span></code> is a variable of type
- pointer-to-arithmetic-type, <code class="computeroutput"><span class="identifier">exp</span></code>
+ <code class="computeroutput"><span class="identifier">b</span></code> and <code class="computeroutput"><span class="identifier">b2</span></code>
+ are a variables of type B, <code class="computeroutput"><span class="identifier">cb</span></code>
+ and <code class="computeroutput"><span class="identifier">cb2</span></code> are constant variables
+ of type B, <code class="computeroutput"><span class="identifier">a</span></code> is a variable
+ of Arithmetic type, <code class="computeroutput"><span class="identifier">s</span></code> is
+ a variable of type <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span></code>, <code class="computeroutput"><span class="identifier">ui</span></code>
+ is a variable of type <code class="computeroutput"><span class="keyword">unsigned</span></code>,
+ <code class="computeroutput"><span class="identifier">bb</span></code> is a variable of type
+ <code class="computeroutput"><span class="keyword">bool</span></code>, <code class="computeroutput"><span class="identifier">pa</span></code>
+ is a variable of type pointer-to-arithmetic-type, <code class="computeroutput"><span class="identifier">exp</span></code>
         is a variable of type <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">exp_type</span></code>, <code class="computeroutput"><span class="identifier">pexp</span></code>
         is a variable of type <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">exp_type</span><span class="special">*</span></code>,
         B2 is another type that meets these requirements, b2 is a variable of type
@@ -2067,6 +2070,113 @@
                 </p>
               </td>
 </tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_qr</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">b</span><span class="special">,</span>
+ <span class="identifier">b2</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">void</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Sets <code class="computeroutput"><span class="identifier">b</span></code> to the result
+ of <code class="computeroutput"><span class="identifier">cb</span> <span class="special">/</span>
+ <span class="identifier">cb2</span></code> and <code class="computeroutput"><span class="identifier">b2</span></code> to the result of <code class="computeroutput"><span class="identifier">cb</span> <span class="special">%</span>
+ <span class="identifier">cb2</span></code>. Only required when
+ <code class="computeroutput"><span class="identifier">B</span></code> is an integer
+ type.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_integer_modulus</span><span class="special">(</span><span class="identifier">cb</span><span class="special">,</span> <span class="identifier">ui</span><span class="special">)</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="keyword">unsigned</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Returns the result of <code class="computeroutput"><span class="identifier">cb</span>
+ <span class="special">%</span> <span class="identifier">ui</span></code>.
+ Only required when <code class="computeroutput"><span class="identifier">B</span></code>
+ is an integer type.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">eval_lsb</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">unsigned</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Returns the index of the least significant bit that is set.<code class="computeroutput">
+ <span class="identifier">Only</span> <span class="identifier">required</span>
+ <span class="identifier">when</span> </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_bit_test(cb,
+ ui)<code class="computeroutput"><span class="special">][</span></code>bool<code class="computeroutput"><span class="special">][</span><span class="identifier">Returns</span>
+ <span class="keyword">true</span> <span class="keyword">if</span>
+ </code>cb<code class="computeroutput"> <span class="identifier">has</span> <span class="identifier">bit</span> </code>ui<code class="computeroutput"> <span class="identifier">set</span><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_bit_set(b,
+ ui)<code class="computeroutput"><span class="special">][</span></code>void<code class="computeroutput"><span class="special">][</span><span class="identifier">Sets</span>
+ <span class="identifier">the</span> <span class="identifier">bit</span>
+ <span class="identifier">at</span> <span class="identifier">index</span>
+ </code>ui<code class="computeroutput"> <span class="identifier">in</span> </code>b<code class="computeroutput"><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_bit_unset(b,
+ ui)<code class="computeroutput"><span class="special">][</span></code>void<code class="computeroutput"><span class="special">][</span><span class="identifier">Unsets</span>
+ <span class="identifier">the</span> <span class="identifier">bit</span>
+ <span class="identifier">at</span> <span class="identifier">index</span>
+ </code>ui<code class="computeroutput"> <span class="identifier">in</span> </code>b<code class="computeroutput"><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_bit_flip(b,
+ ui)<code class="computeroutput"><span class="special">][</span></code>void<code class="computeroutput"><span class="special">][</span><span class="identifier">Flips</span>
+ <span class="identifier">the</span> <span class="identifier">bit</span>
+ <span class="identifier">at</span> <span class="identifier">index</span>
+ </code>ui<code class="computeroutput"> <span class="identifier">in</span> </code>b<code class="computeroutput"><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_gcd(b,
+ cb, cb2)<code class="computeroutput"><span class="special">][</span></code>void<code class="computeroutput"><span class="special">][</span><span class="identifier">Sets</span>
+ </code>b<code class="computeroutput"> <span class="identifier">to</span> <span class="identifier">the</span>
+ <span class="identifier">greatest</span> <span class="identifier">common</span>
+ <span class="identifier">divisor</span> <span class="identifier">of</span>
+ </code>cb<code class="computeroutput"> <span class="keyword">and</span> </code>cb2<code class="computeroutput"><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B<code class="computeroutput"> <span class="identifier">is</span> <span class="identifier">an</span>
+ <span class="identifier">integer</span> <span class="identifier">type</span><span class="special">.]]</span> <span class="special">[[</span></code>eval_lcm(b,
+ cb, cb2)<code class="computeroutput"><span class="special">][</span></code>void<code class="computeroutput"><span class="special">][</span><span class="identifier">Sets</span>
+ </code>b<code class="computeroutput"> <span class="identifier">to</span> <span class="identifier">the</span>
+ <span class="identifier">least</span> <span class="identifier">common</span>
+ <span class="identifier">multiple</span> <span class="identifier">of</span>
+ </code>cb<code class="computeroutput"> <span class="keyword">and</span> </code>cb2<code class="computeroutput"><span class="special">.</span> <span class="identifier">Only</span>
+ <span class="identifier">required</span> <span class="identifier">when</span>
+ </code>B` is an integer type.
+ </p>
+ </td>
+</tr>
 </tbody>
 </table></div>
 </div>
@@ -2085,7 +2195,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -149,6 +149,15 @@
                <span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">q</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">r</span><span class="special">);</span>
 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Integer</span><span class="special">&gt;</span>
 <span class="identifier">Integer</span> <span class="identifier">integer_modulus</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">Integer</span> <span class="identifier">val</span><span class="special">);</span>
+<span class="keyword">unsigned</span> <span class="identifier">lsb</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="identifier">bit_test</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_set</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_unset</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_flip</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">&gt;</span>
 <span class="keyword">bool</span> <span class="identifier">miller_rabin_test</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">trials</span><span class="special">,</span> <span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">gen</span><span class="special">);</span>
 <span class="keyword">bool</span> <span class="identifier">miller_rabin_test</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">trials</span><span class="special">);</span>
@@ -566,6 +575,39 @@
         Returns the absolute value of <code class="computeroutput"><span class="identifier">x</span>
         <span class="special">%</span> <span class="identifier">val</span></code>.
       </p>
+<pre class="programlisting"><span class="keyword">unsigned</span> <span class="identifier">lsb</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<p>
+ Returns the index of the least significant bit that is set to 1.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="identifier">bit_test</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+</pre>
+<p>
+ Returns <code class="computeroutput"><span class="keyword">true</span></code> if the bit at
+ <span class="emphasis"><em>index</em></span> in <span class="emphasis"><em>val</em></span> is set.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_set</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+</pre>
+<p>
+ Sets the bit at <span class="emphasis"><em>index</em></span> in <span class="emphasis"><em>val</em></span>, and
+ returns <span class="emphasis"><em>val</em></span>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_unset</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+</pre>
+<p>
+ Unsets the bit at <span class="emphasis"><em>index</em></span> in <span class="emphasis"><em>val</em></span>,
+ and returns <span class="emphasis"><em>val</em></span>.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;</span>
+<span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">bit_flip</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special">&lt;</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">&gt;&amp;</span> <span class="identifier">val</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">index</span><span class="special">);</span>
+</pre>
+<p>
+ Flips the bit at <span class="emphasis"><em>index</em></span> in <span class="emphasis"><em>val</em></span>,
+ and returns <span class="emphasis"><em>val</em></span>.
+ </p>
 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">&gt;</span>
 <span class="keyword">bool</span> <span class="identifier">miller_rabin_test</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">trials</span><span class="special">,</span> <span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">gen</span><span class="special">);</span>
 <span class="keyword">bool</span> <span class="identifier">miller_rabin_test</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>mp_number-or-expression-template-type</em></span><span class="special">&amp;</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">trials</span><span class="special">);</span>
@@ -639,7 +681,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -31,7 +31,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -486,7 +486,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/primetest.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/primetest.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/primetest.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -93,7 +93,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -143,7 +143,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -532,7 +532,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -491,7 +491,7 @@
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2011 John Maddock<p>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos<p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>

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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -14,9 +14,12 @@
 <div><h2 class="title">
 <a name="boost_multiprecision"></a>Chapter&#160;1.&#160;Boost.Multiprecision</h2></div>
 <div><div class="author"><h3 class="author">
-<span class="firstname">various</span> <span class="surname">authors</span>
+<span class="firstname">John</span> <span class="surname">Maddock</span>
 </h3></div></div>
-<div><p class="copyright">Copyright &#169; 2011 John Maddock</p></div>
+<div><div class="author"><h3 class="author">
+<span class="firstname">Christopher</span> <span class="surname">Kormanyos</span>
+</h3></div></div>
+<div><p class="copyright">Copyright &#169; 2002-2012 John Maddock and Christopher Kormanyos</p></div>
 <div><div class="legalnotice">
 <a name="boost_multiprecision.legal"></a><p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -63,7 +66,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: March 22, 2012 at 08:59:33 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 26, 2012 at 17:54:45 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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -7,14 +7,14 @@
 
 [library Boost.Multiprecision
     [quickbook 1.5]
- [copyright 2011 John Maddock]
+ [copyright 2002-2012 John Maddock and Christopher Kormanyos]
     [purpose Multiprecision Number library]
     [license
          Distributed under the Boost Software License, Version 1.0.
          (See accompanying file LICENSE_1_0.txt or copy at
          [@http://www.boost.org/LICENSE_1_0.txt])
     ]
- [authors [authors, various]]
+ [authors [Maddock, John], [Kormanyos, Christopher]]
     [/last-revision $Date: 2011-07-08 18:51:46 +0100 (Fri, 08 Jul 2011) $]
 ]
 
@@ -869,6 +869,15 @@
                   mp_number<Backend, ExpressionTemplates>& q, mp_number<Backend, ExpressionTemplates>& r);
    template <class Integer>
    Integer integer_modulus(const ``['mp_number-or-expression-template-type]``& x, Integer val);
+ unsigned lsb(const ``['mp_number-or-expression-template-type]``& x);
+ template <class Backend, class ExpressionTemplates>
+ bool bit_test(const mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_set(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_unset(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_flip(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
    template <class Engine>
    bool miller_rabin_test(const ``['mp_number-or-expression-template-type]``& n, unsigned trials, Engine& gen);
    bool miller_rabin_test(const ``['mp_number-or-expression-template-type]``& n, unsigned trials);
@@ -1150,6 +1159,30 @@
 
 Returns the absolute value of `x % val`.
 
+ unsigned lsb(const ``['mp_number-or-expression-template-type]``& x);
+
+Returns the index of the least significant bit that is set to 1.
+
+ template <class Backend, class ExpressionTemplates>
+ bool bit_test(const mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+
+Returns `true` if the bit at /index/ in /val/ is set.
+
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_set(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+
+Sets the bit at /index/ in /val/, and returns /val/.
+
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_unset(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+
+Unsets the bit at /index/ in /val/, and returns /val/.
+
+ template <class Backend, class ExpressionTemplates>
+ mp_number<Backend, ExpressionTemplates>& bit_flip(mp_number<Backend, ExpressionTemplates>& val, unsigned index);
+
+Flips the bit at /index/ in /val/, and returns /val/.
+
    template <class Engine>
    bool miller_rabin_test(const ``['mp_number-or-expression-template-type]``& n, unsigned trials, Engine& gen);
    bool miller_rabin_test(const ``['mp_number-or-expression-template-type]``& n, unsigned trials);
@@ -1209,8 +1242,8 @@
 compulsory requirements, and optional requirements that are either to improve performance
 or provide optional features.
 
-In the following tables, type B is the `Backend` template arument to `mp_number`, `b` is
-a variable of B, `cb` and `cb2` are constant variables of type B, `a` is a variable of Arithmetic type,
+In the following tables, type B is the `Backend` template arument to `mp_number`, `b` and `b2` are
+a variables of type B, `cb` and `cb2` are constant variables of type B, `a` is a variable of Arithmetic type,
 `s` is a variable of type `const char*`, `ui` is a variable of type `unsigned`, `bb` is a variable of type `bool`,
 `pa` is a variable of type pointer-to-arithmetic-type, `exp` is a variable of type `B::exp_type`,
 `pexp` is a variable of type `B::exp_type*`, B2 is another type that meets these requirements, b2 is a variable
@@ -1354,6 +1387,15 @@
 [[`eval_fmod(b, cb, cb2)`][`void`][Performs the equivalent operation to `std::fmod` on arguments `cb` and `cb2`, and store the result in `b`. Only required when `B` is an floating-point type.]]
 [[`eval_pow(b, cb, cb2)`][`void`][Performs the equivalent operation to `std::pow` on arguments `cb` and `cb2`, and store the result in `b`. Only required when `B` is an floating-point type.]]
 [[`eval_atan2(b, cb, cb2)`][`void`][Performs the equivalent operation to `std::atan` on arguments `cb` and `cb2`, and store the result in `b`. Only required when `B` is an floating-point type.]]
+[[`eval_qr(cb, cb2, b, b2)`][`void`][Sets `b` to the result of `cb / cb2` and `b2` to the result of `cb % cb2`. Only required when `B` is an integer type.]]
+[[`eval_integer_modulus(cb, ui)`][`unsigned`][Returns the result of `cb % ui`. Only required when `B` is an integer type.]]
+[[`eval_lsb(cb)`][`unsigned`][Returns the index of the least significant bit that is set.` Only required when `B` is an integer type.]]
+[[`eval_bit_test(cb, ui)`][`bool`][Returns true if `cb` has bit `ui` set. Only required when `B` is an integer type.]]
+[[`eval_bit_set(b, ui)`][`void`][Sets the bit at index `ui` in `b`. Only required when `B` is an integer type.]]
+[[`eval_bit_unset(b, ui)`][`void`][Unsets the bit at index `ui` in `b`. Only required when `B` is an integer type.]]
+[[`eval_bit_flip(b, ui)`][`void`][Flips the bit at index `ui` in `b`. Only required when `B` is an integer type.]]
+[[`eval_gcd(b, cb, cb2)`][`void`][Sets `b` to the greatest common divisor of `cb` and `cb2`. Only required when `B` is an integer type.]]
+[[`eval_lcm(b, cb, cb2)`][`void`][Sets `b` to the least common multiple of `cb` and `cb2`. Only required when `B` is an integer type.]]
 ]
 
 [note
@@ -1731,6 +1773,10 @@
 
 * Add backend support for libdecNumber.
 * Add an adapter backend for complex number types.
+* Add a backend for MPFR interval arithmetic.
+* Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend.
+* Add assembly level routines to cpp_int_backend.
+* Add an all C++ binary floating point type.
 
 [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-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -405,6 +405,20 @@
       BOOST_TEST(r = a % b);
       BOOST_TEST(integer_modulus(a, -57) == abs(a % -57));
    }
+ for(unsigned i = 0; i < 20; ++i)
+ {
+ if(std::numeric_limits<Real>::is_specialized && (!std::numeric_limits<Real>::is_bounded || (i * 17 < std::numeric_limits<Real>::digits)))
+ {
+ BOOST_TEST(lsb(Real(1) << (i * 17)) == i * 17);
+ BOOST_TEST(bit_test(Real(1) << (i * 17), i * 17));
+ BOOST_TEST(!bit_test(Real(1) << (i * 17), i * 17 + 1));
+ BOOST_TEST(!bit_test(Real(1) << (i * 17), i * 17 - 1));
+ BOOST_TEST(bit_test(bit_set(Real(0), i * 17), i * 17));
+ BOOST_TEST(bit_flip(Real(0), i*17) == Real(1) << i * 17);
+ BOOST_TEST(bit_flip(Real(Real(1) << i * 17), i * 17) == 0);
+ BOOST_TEST(bit_unset(Real(Real(1) << i * 17), i * 17) == 0);
+ }
+ }
 }
 
 template <class Real, class T>

Modified: sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_cpp_int.cpp 2012-03-27 07:45:01 EDT (Tue, 27 Mar 2012)
@@ -133,6 +133,15 @@
       BOOST_CHECK_EQUAL((mpz_int(a)^=-b).str(), (test_type(a1) ^= -b1).str());
       BOOST_CHECK_EQUAL(mpz_int(-a^-b).str(), test_type(-a1 ^ -b1).str());
       BOOST_CHECK_EQUAL((mpz_int(-a)^=-b).str(), (test_type(-a1) ^= -b1).str());
+ // Shift ops:
+ for(unsigned i = 0; i < 128; ++i)
+ {
+ if(!std::numeric_limits<test_type>::is_bounded)
+ {
+ BOOST_CHECK_EQUAL(mpz_int(a << i).str(), test_type(a1 << i).str());
+ }
+ BOOST_CHECK_EQUAL(mpz_int(a >> i).str(), test_type(a1 >> i).str());
+ }
       // Now check operations involving signed integers:
       BOOST_CHECK_EQUAL(mpz_int(a + si).str(), test_type(a1 + si).str());
       BOOST_CHECK_EQUAL(mpz_int(a + -si).str(), test_type(a1 + -si).str());


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