|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77335 - in sandbox/big_number: boost/multiprecision libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut libs/multiprecision/example libs/multiprecision/performance libs/multiprecision/test
From: john_at_[hidden]
Date: 2012-03-14 14:23:47
Author: johnmaddock
Date: 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
New Revision: 77335
URL: http://svn.boost.org/trac/boost/changeset/77335
Log:
Mostly remove references to fixed_int.
Update docs.
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 11 +++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html | 19 +++++
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html | 145 +++++++++++++++++----------------------
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html | 90 +++++++++++++++++-------
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html | 2
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html | 126 +++++++++++++++++++++++++---------
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html | 122 ++++++++++++++++++++++++++++++++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html | 6
sandbox/big_number/libs/multiprecision/doc/html/index.html | 4
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 24 ++++--
sandbox/big_number/libs/multiprecision/example/cpp_int_snips.cpp | 2
sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 | 2
sandbox/big_number/libs/multiprecision/performance/performance_test.cpp | 12 ---
sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp | 27 ------
sandbox/big_number/libs/multiprecision/test/test_int_io.cpp | 21 -----
sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp | 16 ---
16 files changed, 394 insertions(+), 235 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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -2141,6 +2141,17 @@
typedef rational_adapter<cpp_int_backend<> > cpp_rational_backend;
typedef mp_number<cpp_rational_backend> cpp_rational;
+// Fixed precision unsigned types:
+typedef mp_number<cpp_int_backend<128, false, void> > mp_uint128_t;
+typedef mp_number<cpp_int_backend<256, false, void> > mp_uint256_t;
+typedef mp_number<cpp_int_backend<512, false, void> > mp_uint512_t;
+
+// Fixed precision signed types:
+typedef mp_number<cpp_int_backend<128, true, void> > mp_int128_t;
+typedef mp_number<cpp_int_backend<256, true, void> > mp_int256_t;
+typedef mp_number<cpp_int_backend<512, true, void> > mp_int512_t;
+
+
}} // namespaces
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -57,6 +57,19 @@
<span class="identifier">my_float</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">;</span> <span class="comment">// These variables have 300 decimal digits precision</span>
</pre>
+<p>
+ We can repeat the above example, but with the expression templates disabled
+ (for faster compile times, but slower runtimes) by passing a second template
+ argument to <code class="computeroutput"><span class="identifier">mp_number</span></code>:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">mpfr</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="comment">// Defines the Backend type that wraps MPFR</span>
+
+<span class="keyword">namespace</span> <span class="identifier">mp</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> <span class="comment">// Reduce the typing a bit later...</span>
+
+<span class="keyword">typedef</span> <span class="identifier">mp</span><span class="special">::</span><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">mp</span><span class="special">::</span><span class="identifier">mpfr_float_backend</span><span class="special"><</span><span class="number">300</span><span class="special">>,</span> <span class="keyword">false</span><span class="special">></span> <span class="identifier">my_float</span><span class="special">;</span>
+
+<span class="identifier">my_float</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">c</span><span class="special">;</span> <span class="comment">// These variables have 300 decimal digits precision</span>
+</pre>
<h5>
<a name="boost_multiprecision.intro.h0"></a>
<span><a name="boost_multiprecision.intro.expression_templates"></a></span><a class="link" href="intro.html#boost_multiprecision.intro.expression_templates">Expression
@@ -304,6 +317,12 @@
</li>
</ul></div>
<p>
+ Finally, note that <code class="computeroutput"><span class="identifier">mp_number</span></code>
+ takes a second template argument, which, when set to <code class="computeroutput"><span class="keyword">false</span></code>
+ disables all the expression template machinary. The result is much faster to
+ compile, but slower at runtime.
+ </p>
+<p>
We'll conclude this section by providing some more performance comparisons
between these three libraries, again, all are using MPFR
to carry out the underlying arithmetic, and all are operating at the same precision
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -330,7 +330,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">)</span></code>
</p>
</td>
@@ -348,7 +348,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">)</span></code>
</p>
</td>
@@ -367,7 +367,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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></code>
</p>
</td>
@@ -386,7 +386,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">)</span></code>
</p>
</td>
@@ -404,7 +404,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <code class="computeroutput"><span class="identifier">eval_modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
<span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
@@ -425,8 +425,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_and</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_and</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -446,8 +445,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_or</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_or</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -467,8 +465,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_xor</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_xor</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -488,8 +485,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">complement</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_complement</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -509,8 +505,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">left_shift</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">ui</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_left_shift</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ui</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -530,8 +525,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">right_shift</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">ui</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_right_shift</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> <span class="identifier">ui</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -551,8 +545,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">convert_to</span><span class="special">(</span><span class="identifier">pa</span><span class="special">,</span>
- <span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_convert_to</span><span class="special">(</span><span class="identifier">pa</span><span class="special">,</span> <span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -807,7 +800,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">)</span></code>
</p>
</td>
@@ -827,7 +820,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">)</span></code>
</p>
</td>
@@ -849,7 +842,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">)</span></code>
</p>
</td>
@@ -871,7 +864,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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>
</td>
@@ -891,7 +884,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <code class="computeroutput"><span class="identifier">eval_modulus</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>
</td>
@@ -914,8 +907,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_and</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">a</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_and</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>
</td>
<td>
@@ -937,8 +929,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_or</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">a</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_or</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>
</td>
<td>
@@ -960,8 +951,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_xor</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
- <span class="identifier">a</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_xor</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>
</td>
<td>
@@ -983,7 +973,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">cb2</span><span class="special">)</span></code>
</p>
@@ -1003,7 +993,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">cb2</span><span class="special">)</span></code>
</p>
@@ -1024,7 +1014,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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>
</p>
@@ -1045,7 +1035,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">cb2</span><span class="special">)</span></code>
</p>
@@ -1066,7 +1056,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">a</span><span class="special">)</span></code>
</p>
@@ -1087,7 +1077,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">a</span><span class="special">)</span></code>
</p>
@@ -1111,7 +1101,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">)</span></code>
</p>
@@ -1135,7 +1125,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">cb</span><span class="special">,</span>
<span class="identifier">a</span><span class="special">)</span></code>
</p>
@@ -1159,7 +1149,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <code class="computeroutput"><span class="identifier">eval_modulus</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>
@@ -1182,9 +1172,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_and</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_and</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>
@@ -1205,9 +1193,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_or</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_or</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>
@@ -1228,9 +1214,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_xor</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_xor</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>
@@ -1251,7 +1235,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">add</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">,</span>
<span class="identifier">cb</span><span class="special">)</span></code>
</p>
@@ -1274,7 +1258,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">subtract</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">,</span>
<span class="identifier">cb</span><span class="special">)</span></code>
</p>
@@ -1298,7 +1282,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">multiply</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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">a</span><span class="special">,</span>
<span class="identifier">cb</span><span class="special">)</span></code>
</p>
@@ -1322,7 +1306,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">divide</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <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>
<span class="identifier">cb</span><span class="special">)</span></code>
</p>
@@ -1345,7 +1329,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <code class="computeroutput"><span class="identifier">eval_modulus</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>
@@ -1370,9 +1354,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_and</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_and</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>
@@ -1395,9 +1377,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_or</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_or</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>
@@ -1420,9 +1400,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_xor</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_xor</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>
@@ -1445,7 +1423,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">modulus</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
+ <code class="computeroutput"><span class="identifier">eval_modulus</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>
@@ -1470,9 +1448,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_and</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_and</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>
@@ -1495,9 +1471,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_or</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_or</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>
@@ -1520,9 +1494,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">bitwise_xor</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>
+ <code class="computeroutput"><span class="identifier">eval_bitwise_xor</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>
@@ -1545,9 +1517,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">left_shift</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">ui</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_left_shift</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">ui</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -1568,9 +1538,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">right_shift</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">ui</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_right_shift</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">ui</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -1591,7 +1559,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">increment</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_increment</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -1609,7 +1577,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">decrement</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_decrement</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -1627,7 +1595,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">is_zero</span><span class="special">(</span><span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_is_zero</span><span class="special">(</span><span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -1644,7 +1612,7 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">get_sign</span><span class="special">(</span><span class="identifier">cb</span><span class="special">)</span></code>
+ <code class="computeroutput"><span class="identifier">eval_get_sign</span><span class="special">(</span><span class="identifier">cb</span><span class="special">)</span></code>
</p>
</td>
<td>
@@ -2102,7 +2070,18 @@
</tbody>
</table></div>
</div>
-<br class="table-break">
+<br class="table-break"><div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ The non-member functions are all named with an "eval_" prefix
+ to avoid conflicts with template classes of the same name - in point of
+ fact this naming convension shouldn't be necessary, but rather works around
+ some compiler bugs.
+ </p></td></tr>
+</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -23,7 +23,7 @@
</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="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">></span>
<span class="keyword">class</span> <span class="identifier">mp_number</span>
<span class="special">{</span>
<span class="identifier">mp_number</span><span class="special">();</span>
@@ -94,15 +94,15 @@
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">>=(</span><span class="keyword">const</span> <span class="emphasis"><em>see-below</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>see-below</em></span><span class="special">&);</span>
<span class="comment">// Swap:</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">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">b</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">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">b</span><span class="special">);</span>
<span class="comment">// iostream support:</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">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">r</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">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">r</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span><span class="special">&</span> <span class="identifier">r</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">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special">>></span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">r</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">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special">>></span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">r</span><span class="special">);</span>
<span class="comment">// Non-member function standard library support:</span>
<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">abs</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">&);</span>
@@ -163,8 +163,8 @@
<span class="comment">// numeric_limits support:</span>
<span class="keyword">namespace</span> <span class="identifier">std</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">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special"><</span><span class="identifier">Backend</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="keyword">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span> <span class="special">></span>
<span class="special">{</span>
<span class="comment">/* Usual members here */</span>
<span class="special">};</span>
@@ -175,6 +175,27 @@
<a name="boost_multiprecision.ref.mp_number.h1"></a>
<span><a name="boost_multiprecision.ref.mp_number.description"></a></span><a class="link" href="mp_number.html#boost_multiprecision.ref.mp_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="keyword">bool</span> <span class="identifier">ExpressionTemplates</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">mp_number</span><span class="special">;</span>
+</pre>
+<p>
+ Class <code class="computeroutput"><span class="identifier">mp_number</span></code> has two template
+ arguments:
+ </p>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl>
+<dt><span class="term">Backend</span></dt>
+<dd><p>
+ The actual arithmetic backend that does all the work.
+ </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.
+ </p></dd>
+</dl>
+</div>
<pre class="programlisting"><span class="identifier">mp_number</span><span class="special">();</span>
<span class="identifier">mp_number</span><span class="special">(</span><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span><span class="special">);</span>
<span class="identifier">mp_number</span><span class="special">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span><span class="special">);</span>
@@ -235,7 +256,8 @@
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
- Another <code class="computeroutput"><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">></span></code>.
+ Another <code class="computeroutput"><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span>
+ <span class="identifier">ExpressionTemplates</span><span class="special">></span></code>.
</li>
<li class="listitem">
A builtin arithmetic type.
@@ -309,7 +331,7 @@
the precision of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
respectively.
</p>
-<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">compare</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">o</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">compare</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">o</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">V</span><span class="special">></span>
<span class="keyword">typename</span> <span class="identifier">enable_if</span><span class="special"><</span><span class="identifier">is_arithmetic</span><span class="special"><</span><span class="identifier">V</span><span class="special">>,</span> <span class="keyword">int</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">compare</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">V</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
</pre>
@@ -377,12 +399,25 @@
In addition, one of the two arguments may be a builtin arithmetic type.
</p>
<p>
- With the exception of the comparison operators (which always evaluate their
- arguments and return a <code class="computeroutput"><span class="keyword">bool</span></code>
- result), these operators return an "unmentionable" expression template
- type which defers evaluation of the operator until the result is actually
- required.
+ The return type of these operators is either:
</p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ An <span class="emphasis"><em>unmentionable-type</em></span> expression template type when
+ <code class="computeroutput"><span class="identifier">ExpressionTemplates</span></code> is
+ <code class="computeroutput"><span class="keyword">true</span></code>.
+ </li>
+<li class="listitem">
+ Type <code class="computeroutput"><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span>
+ <span class="keyword">false</span><span class="special">></span></code>
+ when <code class="computeroutput"><span class="identifier">ExpressionTemplates</span></code>
+ is <code class="computeroutput"><span class="keyword">false</span></code>.
+ </li>
+<li class="listitem">
+ Type <code class="computeroutput"><span class="keyword">bool</span></code> if the operator
+ is a comparison operator.
+ </li>
+</ul></div>
<p>
Finally note that the second argument to the left and right shift operations
must be a builtin integer type, and that the argument must be positive (negative
@@ -393,8 +428,8 @@
<a name="boost_multiprecision.ref.mp_number.h3"></a>
<span><a name="boost_multiprecision.ref.mp_number.swap"></a></span><a class="link" href="mp_number.html#boost_multiprecision.ref.mp_number.swap">swap</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="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">b</span><span class="special">);</span>
+<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">ExpressionTemplates</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">b</span><span class="special">);</span>
</pre>
<p>
Swaps <code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>.
@@ -404,12 +439,12 @@
<span><a name="boost_multiprecision.ref.mp_number.iostream_support"></a></span><a class="link" href="mp_number.html#boost_multiprecision.ref.mp_number.iostream_support">Iostream
Support</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">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">r</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>
+<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">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">r</span><span class="special">);</span>
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Unspecified</span><span class="special">...></span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">unmentionable</span><span class="special">-</span><span class="identifier">expression</span><span class="special">-</span><span class="keyword">template</span><span class="special">&</span> <span class="identifier">r</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">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special">>></span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">>&</span> <span class="identifier">r</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">bool</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
+<span class="keyword">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="keyword">operator</span> <span class="special">>></span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span><span class="special">&</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">>&</span> <span class="identifier">r</span><span class="special">)</span>
</pre>
<p>
These operators provided formatted input-output operations on <code class="computeroutput"><span class="identifier">mp_number</span></code> types, and expression templates
@@ -460,8 +495,9 @@
<p>
These functions all behave exactly as their standard library counterparts
do: their argument is either an instance of <code class="computeroutput"><span class="identifier">mp_number</span></code>
- or an expression template derived from it; their return value is always an
- expression template.
+ or an expression template derived from it; If the argument is of type <code class="computeroutput"><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="keyword">false</span><span class="special">></span></code>
+ then that is also the return type, otherwise the return type is an expression
+ template.
</p>
<p>
These functions are normally implemented by the Backend type. However, default
@@ -541,8 +577,8 @@
</h5>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">std</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">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special"><</span><span class="identifier">Backend</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">ExpressionTemplates</span><span class="special">></span>
+<span class="keyword">struct</span> <span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special"><</span><span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span> <span class="special">></span>
<span class="special">{</span>
<span class="comment">/* Usual members here */</span>
<span class="special">};</span>
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -19,7 +19,7 @@
</h2></div></div></div>
<div class="toc"><dl>
<dt><span class="section">Integer Types</span></dt>
-<dt><span class="section">Real Numbers</span></dt>
+<dt><span class="section">Floating Point Numbers</span></dt>
<dt><span class="section">Rational Number Types</span></dt>
</dl></div>
<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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -7,7 +7,7 @@
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../tut.html" title="Tutorial">
<link rel="prev" href="../tut.html" title="Tutorial">
-<link rel="next" href="reals.html" title="Real Numbers">
+<link rel="next" href="reals.html" title="Floating Point Numbers">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="spirit-nav">
@@ -130,12 +130,12 @@
<tr>
<td>
<p>
- <code class="computeroutput"><span class="identifier">fixed_int</span></code>
+ <code class="computeroutput"><span class="identifier">cpp_int</span></code>
</p>
</td>
<td>
<p>
- boost/multiprecision/fixed_int.hpp
+ boost/multiprecision/cpp_int.hpp
</p>
</td>
<td>
@@ -150,7 +150,8 @@
</td>
<td>
<p>
- Boost licenced fixed precision modular arithmetic integer.
+ Very versatile, Boost licenced, all C++ integer type which support
+ both arbitrary precision and fixed precision integer types.
</p>
</td>
<td>
@@ -336,47 +337,83 @@
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="special">}</span>
-
</pre>
<p>
</p>
<h5>
<a name="boost_multiprecision.tut.ints.h4"></a>
- <span><a name="boost_multiprecision.tut.ints.fixed_int"></a></span><a class="link" href="ints.html#boost_multiprecision.tut.ints.fixed_int">fixed_int</a>
+ <span><a name="boost_multiprecision.tut.ints.cpp_int"></a></span><a class="link" href="ints.html#boost_multiprecision.tut.ints.cpp_int">cpp_int</a>
</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">unsigned</span> <span class="identifier">Digits</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Signed</span><span class="special">></span>
-<span class="keyword">class</span> <span class="identifier">fixed_int</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">type</span> <span class="identifier">limb_type</span><span class="special">;</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="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="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_uint128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_uint256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_uint512_t</span><span class="special">;</span>
-
-<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_int128_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_int256_t</span><span class="special">;</span>
-<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">fixed_int</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="special">></span> <span class="identifier">mp_int512_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_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">mp_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">mp_uint128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_uint256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_uint512_t</span><span class="special">;</span>
+
+<span class="comment">// Fixed precision signed types:</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_int128_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_int256_t</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_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">mp_int512_t</span><span class="special">;</span>
<span class="special">}}</span> <span class="comment">// namespaces</span>
</pre>
<p>
- The <code class="computeroutput"><span class="identifier">fixed_int</span></code> backend is
- used via one of the typedefs <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint128_t</span></code>,
- <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint256_t</span></code>, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint512_t</span></code>,
- <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int128_t</span></code>, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int256_t</span></code>
- or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int512_t</span></code>. It provides both signed and
- unsigned integer types with a fixed precision and modular arithmetic with
- a 2's complement representation for negative values. In other words it's
- designed to work just like a typical built in integer type, but with larger
- precision.
- </p>
+ The <code class="computeroutput"><span class="identifier">cpp_int_backend</span></code> type
+ is used via one of the typedefs <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_int</span></code>,
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint128_t</span></code>, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint256_t</span></code>,
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_uint512_t</span></code>, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int128_t</span></code>,
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int256_t</span></code> or <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_int512_t</span></code>.
+ </p>
+<p>
+ This backend is the "Swiss Army Knife" of integer types as it can
+ represent both fixed and arbitrary precision integer types, and both signed
+ and unsigned types. There are three template arguments:
+ </p>
+<div class="variablelist">
+<p class="title"><b></b></p>
+<dl>
+<dt><span class="term">MinBits</span></dt>
+<dd><p>
+ Determines the number of Bits to store directly within the object before
+ resorting to dynamic memory allocation. When zero, this field is determined
+ automatically based on how many bits can be stored in union with the
+ dynamic storage header: setting a larger value may improve performance
+ as larger integer values will be stored internally before memory allocation
+ is required. When the Allocator parameter is type <code class="computeroutput"><span class="keyword">void</span></code>,
+ then this field determines the total number of bits in the resulting
+ fixed precision type.
+ </p></dd>
+<dt><span class="term">Signed</span></dt>
+<dd><p>
+ Determines whether the resulting type is signed or not. Note that for
+ arbitrary precision types (where the Allocator parameter is non-void),
+ then this parameter must be <code class="computeroutput"><span class="keyword">true</span></code>.
+ For fixed precision types then this type may be either <code class="computeroutput"><span class="keyword">true</span></code> (type is signed), or <code class="computeroutput"><span class="keyword">false</span></code> (type is unsigned).
+ </p></dd>
+<dt><span class="term">Allocator</span></dt>
+<dd><p>
+ The allocator to use for dymamic memory allocation, or type <code class="computeroutput"><span class="keyword">void</span></code> if this is to be a fixed precision
+ type.
+ </p></dd>
+</dl>
+</div>
<p>
Things you should know when using this type:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
- Default constructed <code class="computeroutput"><span class="identifier">fixed_int</span></code>'s
- have indeterminate value - just like normal built in integers.
+ Default constructed <code class="computeroutput"><span class="identifier">cpp_int_backend</span></code>'s
+ have the value zero.
</li>
<li class="listitem">
Division by zero results in a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
@@ -387,9 +424,26 @@
results in a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code> being thrown.
</li>
<li class="listitem">
- Since the precision of <code class="computeroutput"><span class="identifier">fixed_int</span></code>
- is necessarily limited, care should be taken to avoid numeric overflow
- when using this type unless you actually want modulo-arithmetic behavior.
+ Since the precision of <code class="computeroutput"><span class="identifier">cpp_int_backend</span></code>
+ is necessarily limited when the allocator parameter is void, care should
+ be taken to avoid numeric overflow when using this type unless you actually
+ want modulo-arithmetic behavior.
+ </li>
+<li class="listitem">
+ The type uses a sign-magnitude representation internally, so type <code class="computeroutput"><span class="identifier">mp_int128_t</span></code> has 128-bits of precision
+ plus an extra sign bit. In this respect the behaviour of these types
+ differs from built-in 2's complement types. In might be tempting to use
+ a 127-bit type instead, and indeed this does work, but behaviour is still
+ slightly different from a 2's complement built-in type as the min and
+ max values are identical (apart from the sign), where as they differ
+ by one for a true 2's complement type. That said it should be noted that
+ there's no requirement for built-in types to be 2's complement either
+ - it's simply that this is the most common format by far.
+ </li>
+<li class="listitem">
+ Attempting to print negative values as either an Octal or Hexadecimal
+ string results in a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
+ being thrown, this is a direct consequence of the sign-magnitude representation.
</li>
</ul></div>
<h6>
@@ -398,20 +452,24 @@
</h6>
<p>
</p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">fixed_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span>
<span class="identifier">mp_int128_t</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
-<span class="comment">// Do some arithmetic:</span>
+<span class="comment">// Do some fixed precision arithmetic:</span>
<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
<span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 20!</span>
-<span class="identifier">v</span> <span class="special">=</span> <span class="special">-</span><span class="identifier">v</span><span class="special">;</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2's complement representation</span>
+<span class="comment">// Try again at arbitrary precision:</span>
+<span class="identifier">cpp_int</span> <span class="identifier">u</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">100</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
+ <span class="identifier">u</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">u</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 100!</span>
</pre>
<p>
</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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../tut.html" title="Tutorial">
-<link rel="prev" href="reals.html" title="Real Numbers">
+<link rel="prev" href="reals.html" title="Floating Point Numbers">
<link rel="next" href="../ref.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -98,6 +98,38 @@
<tr>
<td>
<p>
+ <code class="computeroutput"><span class="identifier">cpp_rational</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ boost/multiprecision/cpp_int.hpp
+ </p>
+ </td>
+<td>
+ <p>
+ 2
+ </p>
+ </td>
+<td>
+ <p>
+ None
+ </p>
+ </td>
+<td>
+ <p>
+ An all C++ Boost-licenced implementation.
+ </p>
+ </td>
+<td>
+ <p>
+ Slower than GMP.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
<code class="computeroutput"><span class="identifier">tommath_rational</span></code>
</p>
</td>
@@ -230,6 +262,10 @@
</li>
</ul></div>
<p>
+ There is also a two-argument constructor that accepts a numerator and denominator
+ (both of type <code class="computeroutput"><span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">gmp_int</span><span class="special">></span></code>).
+ </p>
+<p>
There are also non-member functions:
</p>
<pre class="programlisting"><span class="identifier">mpz_int</span> <span class="identifier">numerator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mpq_rational</span><span class="special">&);</span>
@@ -298,6 +334,81 @@
</p>
<h5>
<a name="boost_multiprecision.tut.rational.h2"></a>
+ <span><a name="boost_multiprecision.tut.rational.cpp_rational"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.cpp_rational">cpp_rational</a>
+ </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">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">mp_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="special">}}</span> <span class="comment">// namespaces</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">cpp_rational_backend</span></code>
+ type is used via the typedef <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_rational</span></code>.
+ It provides a rational number type that is a drop-in replacement for the
+ native C++ number types, but with unlimited precision.
+ </p>
+<p>
+ As well as the usual conversions from arithmetic and string types, instances
+ of <code class="computeroutput"><span class="identifier">cpp_rational</span></code> are copy
+ constructible and assignable from type <code class="computeroutput"><span class="identifier">cpp_int</span></code>.
+ </p>
+<p>
+ There is also a two argument constructor that accepts a numerator and denominator:
+ both of type <code class="computeroutput"><span class="identifier">cpp_int</span></code>.
+ </p>
+<p>
+ There are also non-member functions:
+ </p>
+<pre class="programlisting"><span class="identifier">cpp_int</span> <span class="identifier">numerator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">cpp_rational</span><span class="special">&);</span>
+<span class="identifier">cpp_int</span> <span class="identifier">denominator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">cpp_rational</span><span class="special">&);</span>
+</pre>
+<p>
+ which return the numerator and denominator of the number.
+ </p>
+<p>
+ Things you should know when using this type:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ Default constructed <code class="computeroutput"><span class="identifier">cpp_rational</span></code>'s
+ have the value zero.
+ </li>
+<li class="listitem">
+ Division by zero results in a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">rumtime_error</span></code>
+ being thrown.
+ </li>
+</ul></div>
+<h6>
+<a name="boost_multiprecision.tut.rational.h3"></a>
+ <span><a name="boost_multiprecision.tut.rational.example0"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.example0">Example:</a>
+ </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span>
+
+<span class="identifier">cpp_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+
+<span class="comment">// Do some arithmetic:</span>
+<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
+ <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span>
+<span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+<span class="identifier">cpp_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// component wise constructor</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span>
+</pre>
+<p>
+ </p>
+<h5>
+<a name="boost_multiprecision.tut.rational.h4"></a>
<span><a name="boost_multiprecision.tut.rational.tommath_rational"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.tommath_rational">tommath_rational</a>
</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>
@@ -351,8 +462,8 @@
</li>
</ul></div>
<h6>
-<a name="boost_multiprecision.tut.rational.h3"></a>
- <span><a name="boost_multiprecision.tut.rational.example0"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.example0">Example:</a>
+<a name="boost_multiprecision.tut.rational.h5"></a>
+ <span><a name="boost_multiprecision.tut.rational.example1"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.example1">Example:</a>
</h6>
<p>
</p>
@@ -373,12 +484,11 @@
<span class="identifier">mp_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// Component wise constructor</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span>
-
</pre>
<p>
</p>
<h5>
-<a name="boost_multiprecision.tut.rational.h4"></a>
+<a name="boost_multiprecision.tut.rational.h6"></a>
<span><a name="boost_multiprecision.tut.rational.use_with_boost_rational"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.use_with_boost_rational">Use With
Boost.Rational</a>
</h5>
@@ -391,7 +501,7 @@
expression templates in <code class="computeroutput"><span class="identifier">mp_number</span></code>.
</p>
<h5>
-<a name="boost_multiprecision.tut.rational.h5"></a>
+<a name="boost_multiprecision.tut.rational.h7"></a>
<span><a name="boost_multiprecision.tut.rational.rational_adapter"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.rational_adapter">rational_adapter</a>
</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>
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -1,7 +1,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Real Numbers</title>
+<title>Floating Point Numbers</title>
<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
@@ -15,10 +15,10 @@
</div>
<div class="section boost_multiprecision_tut_reals">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_multiprecision.tut.reals"></a><a class="link" href="reals.html" title="Real Numbers">Real Numbers</a>
+<a name="boost_multiprecision.tut.reals"></a><a class="link" href="reals.html" title="Floating Point Numbers">Floating Point Numbers</a>
</h3></div></div></div>
<p>
- The following backends provide real number arithmetic:
+ The following backends provide floating point arithmetic:
</p>
<div class="informaltable"><table class="table">
<colgroup>
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -31,7 +31,7 @@
<dt><span class="section">Tutorial</span></dt>
<dd><dl>
<dt><span class="section">Integer Types</span></dt>
-<dt><span class="section">Real Numbers</span></dt>
+<dt><span class="section">Floating Point Numbers</span></dt>
<dt><span class="section">Rational Number Types</span></dt>
</dl></dd>
<dt><span class="section">Reference</span></dt>
@@ -56,7 +56,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: February 15, 2012 at 18:08:37 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 13, 2012 at 19:12:03 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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -306,14 +306,14 @@
typedef mp_number<cpp_rational_backend> cpp_rational; // arbitrary precision rational number
// Fixed precision unsigned types:
- typedef mp_number<cpp_int<128, false, void> > mp_uint128_t;
- typedef mp_number<fixed_int<256, false, void> > mp_uint256_t;
- typedef mp_number<fixed_int<512, false, void> > mp_uint512_t;
+ typedef mp_number<cpp_int_backend<128, false, void> > mp_uint128_t;
+ typedef mp_number<cpp_int_backend<256, false, void> > mp_uint256_t;
+ typedef mp_number<cpp_int_backend<512, false, void> > mp_uint512_t;
// Fixed precision signed types:
- typedef mp_number<fixed_int<128, true, void> > mp_int128_t;
- typedef mp_number<fixed_int<256, true, void> > mp_int256_t;
- typedef mp_number<fixed_int<512, true, void> > mp_int512_t;
+ typedef mp_number<cpp_int_backend<128, true, void> > mp_int128_t;
+ typedef mp_number<cpp_int_backend<256, true, void> > mp_int256_t;
+ typedef mp_number<cpp_int_backend<512, true, void> > mp_int512_t;
}} // namespaces
@@ -352,6 +352,8 @@
as the min and max values are identical (apart from the sign), where as they differ by one for a true 2's complement type.
That said it should be noted that there's no requirement for built-in types to be 2's complement either - it's simply that this
is the most common format by far.
+* Attempting to print negative values as either an Octal or Hexadecimal string results in a `std::runtime_error` being thrown,
+this is a direct consequence of the sign-magnitude representation.
[h5 Example:]
@@ -516,8 +518,8 @@
[table
[[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
[[`gmp_rational`][boost/multiprecision/gmp.hpp][2][[gmp]][Very fast and efficient backend.][Dependency on GNU licenced [gmp] library.]]
-[[`cpp_rational`][boost/multiprecision/cpp_int.hpp][2][None][An all C++ Boost-licenced implementation.][[Slower than [gmp].]]
-[[`tommath_rational`][boost/multiprecision/tommath.hpp][2][libtommath][All C/C++ implementation that's Boost Software Licence compatible.]
+[[`cpp_rational`][boost/multiprecision/cpp_int.hpp][2][None][An all C++ Boost-licenced implementation.][Slower than [gmp].]]
+[[`tommath_rational`][boost/multiprecision/tommath.hpp][2][libtommath][All C/C++ implementation that's Boost Software Licence compatible.][Slower than [gmp].]]
[[`rational_adapter`][boost/multiprecision/rational_adapter.hpp][N/A][none][All C++ adapter that allows any inetger backend type to be used as a rational type.][Requires an underlying integer backend type.]]
[[`boost::rational`][boost/rational.hpp][N/A][None][A C++ rational number type that can used with any `mp_number` integer type.][The expression templates used by `mp_number` end up being "hidden" inside `boost::rational`: performance may well suffer as a result.]]
]
@@ -541,6 +543,8 @@
* The [gmp] native types: `mpz_t`, `mpq_t`.
* `mp_number<gmp_int>`.
+There is also a two-argument constructor that accepts a numerator and denominator (both of type `mp_number<gmp_int>`).
+
There are also non-member functions:
mpz_int numerator(const mpq_rational&);
@@ -578,6 +582,8 @@
As well as the usual conversions from arithmetic and string types, instances of `cpp_rational` are copy constructible
and assignable from type `cpp_int`.
+There is also a two argument constructor that accepts a numerator and denominator: both of type `cpp_int`.
+
There are also non-member functions:
cpp_int numerator(const cpp_rational&);
@@ -1029,7 +1035,7 @@
``['unmentionable-expression-template-type]`` atan2 (const ``['mp_number-or-expression-template-type]``&, const ``['mp_number-or-expression-template-type]``&);
These functions all behave exactly as their standard library counterparts do: their argument is either an instance of `mp_number` or
-an expression template derived from it; If the argument is of type `mp_number,Backend, false>` then that is also the return type,
+an expression template derived from it; If the argument is of type `mp_number<Backend, false>` then that is also the return type,
otherwise the return type is an expression template.
These functions are normally implemented by the Backend type. However, default versions are provided for Backend types that
Modified: sandbox/big_number/libs/multiprecision/example/cpp_int_snips.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/example/cpp_int_snips.cpp (original)
+++ sandbox/big_number/libs/multiprecision/example/cpp_int_snips.cpp 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -33,7 +33,7 @@
void t3()
{
- //[cpp_rat_eg
+ //[cpp_rational_eg
//=#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
Modified: sandbox/big_number/libs/multiprecision/performance/Jamfile.v2
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 (original)
+++ sandbox/big_number/libs/multiprecision/performance/Jamfile.v2 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -50,7 +50,7 @@
[ check-target-builds ../config//has_mpfr : <define>TEST_MPFR <source>mpfr : ]
[ check-target-builds ../config//has_tommath : <define>TEST_TOMMATH <source>$(TOMMATH) : ]
<define>TEST_CPP_DEC_FLOAT
- <define>TEST_FIXED_INT
+ <define>TEST_CPP_INT
;
exe sf_performance : sf_performance.cpp /boost/system//boost_system
Modified: sandbox/big_number/libs/multiprecision/performance/performance_test.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/performance/performance_test.cpp (original)
+++ sandbox/big_number/libs/multiprecision/performance/performance_test.cpp 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -12,7 +12,7 @@
#if !defined(TEST_MPF) && !defined(TEST_MPZ) && \
!defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPQ) \
&& !defined(TEST_TOMMATH) && !defined(TEST_TOMMATH_BOOST_RATIONAL) && !defined(TEST_MPZ_BOOST_RATIONAL)\
- && !defined(TEST_FIXED_INT) && !defined(TEST_CPP_INT) && !defined(TEST_CPP_INT_RATIONAL)
+ && !defined(TEST_CPP_INT) && !defined(TEST_CPP_INT_RATIONAL)
# define TEST_MPF
# define TEST_MPZ
# define TEST_MPQ
@@ -20,7 +20,6 @@
# define TEST_CPP_DEC_FLOAT
# define TEST_MPQ
# define TEST_TOMMATH
-# define TEST_FIXED_INT
# define TEST_CPP_INT
# define TEST_CPP_INT_RATIONAL
@@ -47,9 +46,6 @@
#include <boost/multiprecision/tommath.hpp>
#include <boost/multiprecision/rational_adapter.hpp>
#endif
-#if defined(TEST_FIXED_INT)
-#include <boost/multiprecision/fixed_int.hpp>
-#endif
#if defined(TEST_CPP_INT)
#include <boost/multiprecision/cpp_int.hpp>
#endif
@@ -619,12 +615,6 @@
test<boost::multiprecision::mp_rational>("mp_rational", 1024);
*/
#endif
-#ifdef TEST_FIXED_INT
- test<boost::multiprecision::mp_int128_t>("fixed_int", 128);
- test<boost::multiprecision::mp_int256_t>("fixed_int", 256);
- test<boost::multiprecision::mp_int512_t>("fixed_int", 512);
- test<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<1024, true> > >("fixed_int", 1024);
-#endif
#ifdef TEST_CPP_DEC_FLOAT
test<boost::multiprecision::cpp_dec_float_50>("cpp_dec_float", 50);
test<boost::multiprecision::cpp_dec_float_100>("cpp_dec_float", 100);
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-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -18,7 +18,7 @@
#if !defined(TEST_MPF_50) && !defined(TEST_MPF) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) && \
!defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPFR_50) && !defined(TEST_MPQ) \
&& !defined(TEST_TOMMATH) && !defined(TEST_TOMMATH_BOOST_RATIONAL) && !defined(TEST_MPZ_BOOST_RATIONAL)\
- && !defined(TEST_FIXED_INT1) && !defined(TEST_FIXED_INT2) && !defined(TEST_CPP_INT) && !defined(TEST_CPP_INT_BR)
+ && !defined(TEST_CPP_INT) && !defined(TEST_CPP_INT_BR)
# define TEST_MPF_50
# define TEST_MPF
# define TEST_BACKEND
@@ -28,8 +28,6 @@
# define TEST_CPP_DEC_FLOAT
# define TEST_MPQ
# define TEST_TOMMATH
-# define TEST_FIXED_INT1
-# define TEST_FIXED_INT2
# define TEST_CPP_INT
# define TEST_CPP_INT_BR
@@ -59,9 +57,6 @@
#include <boost/multiprecision/tommath.hpp>
#include <boost/multiprecision/rational_adapter.hpp>
#endif
-#if defined(TEST_FIXED_INT1) || defined(TEST_FIXED_INT2)
-#include <boost/multiprecision/fixed_int.hpp>
-#endif
#if defined(TEST_CPP_INT) || defined(TEST_CPP_INT_BR)
#include <boost/multiprecision/cpp_int.hpp>
#endif
@@ -1030,26 +1025,10 @@
#ifdef TEST_MPZ_BOOST_RATIONAL
test<boost::rational<boost::multiprecision::mpz_int> >();
#endif
-#ifdef TEST_FIXED_INT1
- test<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<64, false> > >();
- test<boost::multiprecision::mp_uint128_t>();
- test<boost::multiprecision::mp_uint512_t>();
- test<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<70, false> > >();
-#endif
-#ifdef TEST_FIXED_INT2
- //
- // Can't test 64-bit signed ints - they don't have enough bits
- // to interoperate with uint64_t without loss:
- //
- //test<boost::multiprecision::mp_int64_t>();
- test<boost::multiprecision::mp_int128_t>();
- test<boost::multiprecision::mp_int512_t>();
- test<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<70, true> > >();
-#endif
#ifdef TEST_CPP_INT
test<boost::multiprecision::cpp_int>();
- test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, true, void> > >();
- test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, false, void> > >();
+ test<boost::multiprecision::mp_int256_t >();
+ test<boost::multiprecision::mp_uint512_t >();
test<boost::multiprecision::cpp_rational>();
test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<>, false> >();
#endif
Modified: sandbox/big_number/libs/multiprecision/test/test_int_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_int_io.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_int_io.cpp 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -9,11 +9,9 @@
# define _SCL_SECURE_NO_WARNINGS
#endif
-#if !defined(TEST_MPZ) && !defined(TEST_TOMMATH) && !defined(TEST_FIXED_INT1) && !defined(TEST_FIXED_INT2) && !defined(TEST_CPP_INT)
+#if !defined(TEST_MPZ) && !defined(TEST_TOMMATH) && !defined(TEST_CPP_INT)
# define TEST_TOMMATH
# define TEST_MPZ
-# define TEST_FIXED_INT1
-# define TEST_FIXED_INT2
# define TEST_CPP_INT
#ifdef _MSC_VER
@@ -31,9 +29,6 @@
#if defined(TEST_TOMMATH)
#include <boost/multiprecision/tommath.hpp>
#endif
-#if defined(TEST_FIXED_INT1) || defined(TEST_FIXED_INT2)
-#include <boost/multiprecision/fixed_int.hpp>
-#endif
#ifdef TEST_CPP_INT
#include <boost/multiprecision/cpp_int.hpp>
#endif
@@ -127,20 +122,6 @@
#ifdef TEST_TOMMATH
test_round_trip<boost::multiprecision::mp_int>();
#endif
-#ifdef TEST_FIXED_INT1
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<64, false> > >();
- test_round_trip<boost::multiprecision::mp_uint128_t>();
- test_round_trip<boost::multiprecision::mp_uint512_t>();
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<20, false> > >();
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<70, false> > >();
-#endif
-#ifdef TEST_FIXED_INT2
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<64, true> > >();
- test_round_trip<boost::multiprecision::mp_int128_t>();
- test_round_trip<boost::multiprecision::mp_int512_t>();
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<20, true> > >();
- test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::fixed_int<70, true> > >();
-#endif
#ifdef TEST_CPP_INT
test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<> > >();
test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<1024, true, void> > >();
Modified: sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp (original)
+++ sandbox/big_number/libs/multiprecision/test/test_numeric_limits.cpp 2012-03-14 14:23:44 EDT (Wed, 14 Mar 2012)
@@ -11,7 +11,7 @@
#if !defined(TEST_MPF_50) && !defined(TEST_MPF) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) && \
!defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR) && !defined(TEST_MPFR_50) && !defined(TEST_MPQ) && \
- !defined(TEST_TOMMATH) && !defined(TEST_CPP_INT) && !defined(TEST_FIXED_INT)
+ !defined(TEST_TOMMATH) && !defined(TEST_CPP_INT)
# define TEST_MPF_50
# define TEST_MPF
# define TEST_BACKEND
@@ -21,7 +21,6 @@
# define TEST_CPP_DEC_FLOAT
# define TEST_MPQ
# define TEST_TOMMATH
-# define TEST_FIXED_INT
# define TEST_CPP_INT
#ifdef _MSC_VER
@@ -48,9 +47,6 @@
#ifdef TEST_TOMMATH
#include <boost/multiprecision/tommath.hpp>
#endif
-#ifdef TEST_FIXED_INT
-#include <boost/multiprecision/fixed_int.hpp>
-#endif
#ifdef TEST_CPP_INT
#include <boost/multiprecision/cpp_int.hpp>
#endif
@@ -226,16 +222,10 @@
#ifdef TEST_TOMMATH
test<boost::multiprecision::mp_int>();
#endif
-#ifdef TEST_FIXED_INT
- test<boost::multiprecision::mp_int128_t>();
- test<boost::multiprecision::mp_int512_t>();
- test<boost::multiprecision::mp_uint128_t>();
- test<boost::multiprecision::mp_uint512_t>();
-#endif
#ifdef TEST_CPP_INT
test<boost::multiprecision::cpp_int>();
- test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, true, void> > >();
- test<boost::multiprecision::mp_number<boost::multiprecision::cpp_int_backend<256, false, void> > >();
+ test<boost::multiprecision::mp_int256_t>();
+ test<boost::multiprecision::mp_uint512_t>();
#endif
return boost::report_errors();
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk