|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81163 - 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/indexes libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut libs/multiprecision/example
From: john_at_[hidden]
Date: 2012-11-03 14:27:13
Author: johnmaddock
Date: 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
New Revision: 81163
URL: http://svn.boost.org/trac/boost/changeset/81163
Log:
Fix mpfr_float_backend interconversions.
Update docs and regenerate.
Added:
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html (contents, props changed)
sandbox/big_number/libs/multiprecision/example/mixed_integer_arithmetic.cpp (contents, props changed)
Text files modified:
sandbox/big_number/boost/multiprecision/mpfr.hpp | 12 ++--
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 32 ++++++++++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 4
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 42 +++++++++++++++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html | 4 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html | 6 +-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html | 50 +++++++++++++++++-
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html | 1
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rounding.html | 6 +-
sandbox/big_number/libs/multiprecision/doc/html/index.html | 3
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 103 ++++++++++++++++++++++++++++++++++++++++
12 files changed, 238 insertions(+), 29 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/mpfr.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/mpfr.hpp (original)
+++ sandbox/big_number/boost/multiprecision/mpfr.hpp 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -608,14 +608,14 @@
#ifndef BOOST_NO_RVALUE_REFERENCES
mpfr_float_backend(mpfr_float_backend&& o) : detail::mpfr_float_imp<digits10, AllocationType>(static_cast<detail::mpfr_float_imp<digits10, AllocationType>&&>(o)) {}
#endif
- template <unsigned D>
- mpfr_float_backend(const mpfr_float_backend<D>& val, typename enable_if_c<D <= digits10>::type* = 0)
+ template <unsigned D, mpfr_allocation_type AT>
+ mpfr_float_backend(const mpfr_float_backend<D, AT>& val, typename enable_if_c<D <= digits10>::type* = 0)
: detail::mpfr_float_imp<digits10, AllocationType>()
{
mpfr_set(this->m_data, val.data(), GMP_RNDN);
}
- template <unsigned D>
- explicit mpfr_float_backend(const mpfr_float_backend<D>& val, typename disable_if_c<D <= digits10>::type* = 0)
+ template <unsigned D, mpfr_allocation_type AT>
+ explicit mpfr_float_backend(const mpfr_float_backend<D, AT>& val, typename disable_if_c<D <= digits10>::type* = 0)
: detail::mpfr_float_imp<digits10, AllocationType>()
{
mpfr_set(this->m_data, val.data(), GMP_RNDN);
@@ -701,8 +701,8 @@
return *this;
}
// We don't change our precision here, this is a fixed precision type:
- template <unsigned D>
- mpfr_float_backend& operator=(const mpfr_float_backend<D>& val) BOOST_NOEXCEPT
+ template <unsigned D, mpfr_allocation_type AT>
+ mpfr_float_backend& operator=(const mpfr_float_backend<D, AT>& val) BOOST_NOEXCEPT
{
mpfr_set(this->m_data, val.data(), GMP_RNDN);
return *this;
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="../indexes.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id958426">
+<div class="section id961630">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id958426"></a>Function Index</h3></div></div></div>
+<a name="id961630"></a>Function Index</h3></div></div></div>
<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_12">P</a> <a class="link" href="s01.html#idx_id_13">R</a> <a class="link" href="s01.html#idx_id_14">S</a> <a class="link" href="s01.html#idx_id_15">T</a> <a class="link" href="s01.html#idx_id_17">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -27,6 +27,14 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">add</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../map/todo.html" title="TODO"><span class="index-entry-level-1">TODO</span></a></p></li>
+</ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">assign</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
@@ -403,13 +411,22 @@
<dt>
<a name="idx_id_9"></a><span class="term">M</span>
</dt>
-<dd><div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none">
+<dd><div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">miller_rabin_test</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/primetest.html" title="Primality Testing"><span class="index-entry-level-1">Primality Testing</span></a></p></li>
</ul></div>
-</li></ul></div></dd>
+</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">multiply</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+</ul></div>
+</li>
+</ul></div></dd>
<dt>
<a name="idx_id_12"></a><span class="term">P</span>
</dt>
@@ -449,6 +466,13 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">subtract</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+</ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">swap</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id962951">
+<div class="section id966675">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id962951"></a>Class Index</h3></div></div></div>
+<a name="id966675"></a>Class Index</h3></div></div></div>
<p><a class="link" href="s02.html#idx_id_20">C</a> <a class="link" href="s02.html#idx_id_22">E</a> <a class="link" href="s02.html#idx_id_24">G</a> <a class="link" href="s02.html#idx_id_25">I</a> <a class="link" href="s02.html#idx_id_27">M</a> <a class="link" href="s02.html#idx_id_28">N</a> <a class="link" href="s02.html#idx_id_33">T</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -13,9 +13,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id963368">
+<div class="section id967092">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id963368"></a>Typedef Index</h3></div></div></div>
+<a name="id967092"></a>Typedef Index</h3></div></div></div>
<p><a class="link" href="s03.html#idx_id_38">C</a> <a class="link" href="s03.html#idx_id_43">I</a> <a class="link" href="s03.html#idx_id_44">L</a> <a class="link" href="s03.html#idx_id_45">M</a> <a class="link" href="s03.html#idx_id_50">S</a> <a class="link" href="s03.html#idx_id_51">T</a> <a class="link" href="s03.html#idx_id_52">U</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -12,9 +12,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
</div>
-<div class="section id964368">
+<div class="section id968092">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id964368"></a>Index</h3></div></div></div>
+<a name="id968092"></a>Index</h3></div></div></div>
<p><a class="link" href="s04.html#idx_id_54">A</a> <a class="link" href="s04.html#idx_id_55">B</a> <a class="link" href="s04.html#idx_id_56">C</a> <a class="link" href="s04.html#idx_id_57">D</a> <a class="link" href="s04.html#idx_id_58">E</a> <a class="link" href="s04.html#idx_id_59">F</a> <a class="link" href="s04.html#idx_id_60">G</a> <a class="link" href="s04.html#idx_id_61">I</a> <a class="link" href="s04.html#idx_id_62">L</a> <a class="link" href="s04.html#idx_id_63">M</a> <a class="link" href="s04.html#idx_id_64">N</a> <a class="link" href="s04.html#idx_id_65">O</a> <a class="link" href="s04.html#idx_id_66">P</a> <a class="link" href="s04.html#idx_id_67">R</a> <a class="link" href="s04.html#idx_id_68">S</a> <a class="link" href="s04.html#idx_id_69">T</a> <a class="link" href="s04.html#idx_id_70">U</a> <a class="link" href="s04.html#idx_id_71">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -26,6 +26,14 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">add</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../map/todo.html" title="TODO"><span class="index-entry-level-1">TODO</span></a></p></li>
+</ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">assign</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
@@ -661,6 +669,14 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">Mixed Precision Arithmetic</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">add</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">multiply</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">subtract</span></a></p></li>
+</ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">mpfr_float</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/mpfr_float.html" title="mpfr_float"><span class="index-entry-level-1">data</span></a></p></li>
@@ -748,6 +764,13 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/fp_eg/poly_eg.html" title="Polynomial Evaluation"><span class="index-entry-level-1">Polynomial Evaluation</span></a></p></li>
</ul></div>
</li>
+<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">multiply</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+</ul></div>
+</li>
</ul></div></dd>
<dt>
<a name="idx_id_64"></a><span class="term">N</span>
@@ -757,6 +780,7 @@
<p><span class="index-entry-level-0">number</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">abs</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">add</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">assign</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">bit_flip</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">bit_set</span></a></p></li>
@@ -783,12 +807,14 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">lsb</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">ltrunc</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">miller_rabin_test</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">multiply</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><span class="bold"><strong><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></strong></span></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number_category</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">powm</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">precision</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">round</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">str</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">subtract</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">swap</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">trunc</span></a></p></li>
</ul></div>
@@ -911,6 +937,13 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">subtract</span></p>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/mixed.html" title="Mixed Precision Arithmetic"><span class="index-entry-level-1">Mixed Precision Arithmetic</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li>
+</ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">swap</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div>
</li>
@@ -921,7 +954,10 @@
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">TODO</span></p>
-<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../map/todo.html" title="TODO"><span class="index-entry-level-1">cpp_dec_float</span></a></p></li></ul></div>
+<div class="index"><ul class="index" style="list-style-type: none; ">
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../map/todo.html" title="TODO"><span class="index-entry-level-1">add</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../map/todo.html" title="TODO"><span class="index-entry-level-1">cpp_dec_float</span></a></p></li>
+</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">tommath_int</span></p>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -63,6 +63,10 @@
Added additional template parameter to <code class="computeroutput"><span class="identifier">mpfr_float_backend</span></code>
to allow stack-based allocation.
</li>
+<li class="listitem">
+ Added section on mixed precision arithmetic, and added support for operations
+ yielding a higher precision result than either of the arguments.
+ </li>
</ul></div>
<h5>
<a name="boost_multiprecision.map.hist.h1"></a>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -6,12 +6,12 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../index.html" title="Chapter 1. Boost.Multiprecision">
-<link rel="prev" href="tut/rounding.html" title="Rounding Rules for Conversions">
+<link rel="prev" href="tut/mixed.html" title="Mixed Precision Arithmetic">
<link rel="next" href="ref/number.html" title="number">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="spirit-nav">
-<a accesskey="p" href="tut/rounding.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="ref/number.html"><img src="../images/next.png" alt="Next"></a>
+<a accesskey="p" href="tut/mixed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="ref/number.html"><img src="../images/next.png" alt="Next"></a>
</div>
<div class="section boost_multiprecision_ref">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -41,7 +41,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="tut/rounding.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="ref/number.html"><img src="../images/next.png" alt="Next"></a>
+<a accesskey="p" href="tut/mixed.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="ref/number.html"><img src="../images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -115,6 +115,14 @@
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Backend</span><span class="special">,</span> <span class="identifier">expression_template_option</span> <span class="identifier">ExpressionTemplates</span><span class="special">></span>
<span class="identifier">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">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">// Arithmetic with a higher precision result:</span>
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</span><span class="special">&</span> <span class="identifier">b</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>number-or-expression-template-type</em></span><span class="special">&);</span>
<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">fabs</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span>
@@ -566,6 +574,38 @@
</p>
<h5>
<a name="boost_multiprecision.ref.number.h5"></a>
+ <span class="phrase"><a name="boost_multiprecision.ref.number.arithmetic_with_a_higher_precision_result"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.arithmetic_with_a_higher_precision_result">Arithmetic
+ with a higher precision result</a>
+ </h5>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</span><span class="special">&</span> <span class="identifier">b</span><span class="special">);</span>
+</pre>
+<p>
+ These functions apply the named operator to the arguments <span class="emphasis"><em>a</em></span>
+ and <span class="emphasis"><em>b</em></span> and store the result in <span class="emphasis"><em>result</em></span>,
+ returning <span class="emphasis"><em>result</em></span>. In all cases they behave "as
+ if" arguments <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> were
+ first promoted to type <code class="computeroutput"><span class="identifier">ResultType</span></code>
+ before applying the operator, though particular backends may well avoid that
+ step by way of an optimization.
+ </p>
+<p>
+ The type <code class="computeroutput"><span class="identifier">ResultType</span></code> must
+ be an instance of class <code class="computeroutput"><span class="identifier">number</span></code>,
+ and the types <code class="computeroutput"><span class="identifier">Source1</span></code> and
+ <code class="computeroutput"><span class="identifier">Source2</span></code> may be either instances
+ of class <code class="computeroutput"><span class="identifier">number</span></code> or native
+ integer types. The latter is an optimization that allows arithmetic to be
+ performed on native integer types producing an extended precision result.
+ </p>
+<h5>
+<a name="boost_multiprecision.ref.number.h6"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.non_member_standard_library_function_support"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.non_member_standard_library_function_support">Non-member
standard library function support</a>
</h5>
@@ -1008,7 +1048,7 @@
</p></div></td></tr></tbody>
</table></div>
<h5>
-<a name="boost_multiprecision.ref.number.h6"></a>
+<a name="boost_multiprecision.ref.number.h7"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.traits_class_support"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.traits_class_support">Traits Class
Support</a>
</h5>
@@ -1049,7 +1089,7 @@
if T is an expression template type derived from <code class="computeroutput"><span class="identifier">number</span><span class="special"><></span></code>, otherwise from <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code>.
</p>
<h5>
-<a name="boost_multiprecision.ref.number.h7"></a>
+<a name="boost_multiprecision.ref.number.h8"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.integer_functions"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.integer_functions">Integer
functions</a>
</h5>
@@ -1130,7 +1170,7 @@
composite less than 0.25^trials.
</p>
<h5>
-<a name="boost_multiprecision.ref.number.h8"></a>
+<a name="boost_multiprecision.ref.number.h9"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.rational_number_functions"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.rational_number_functions">Rational
Number Functions</a>
</h5>
@@ -1142,7 +1182,7 @@
respectively.
</p>
<h5>
-<a name="boost_multiprecision.ref.number.h9"></a>
+<a name="boost_multiprecision.ref.number.h10"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.boost_math_interoperability_support"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.boost_math_interoperability_support">Boost.Math
Interoperability Support</a>
</h5>
@@ -1165,7 +1205,7 @@
to ensure interoperability.
</p>
<h5>
-<a name="boost_multiprecision.ref.number.h10"></a>
+<a name="boost_multiprecision.ref.number.h11"></a>
<span class="phrase"><a name="boost_multiprecision.ref.number.std__numeric_limits_support"></a></span><a class="link" href="number.html#boost_multiprecision.ref.number.std__numeric_limits_support">std::numeric_limits
support</a>
</h5>
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-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -63,6 +63,7 @@
<dt><span class="section">Literal Types and constexpr
Support</span></dt>
<dt><span class="section"><a href="tut/rounding.html">Rounding Rules for
Conversions</a></span></dt>
+<dt><span class="section">Mixed Precision Arithmetic</span></dt>
</dl></div>
<p>
In order to use this library you need to make two choices: what kind of number
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -0,0 +1,169 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Mixed Precision Arithmetic</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.77.1">
+<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../tut.html" title="Tutorial">
+<link rel="prev" href="rounding.html" title="Rounding Rules for Conversions">
+<link rel="next" href="../ref.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="rounding.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_multiprecision_tut_mixed">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_multiprecision.tut.mixed"></a><a class="link" href="mixed.html" title="Mixed Precision Arithmetic">Mixed Precision Arithmetic</a>
+</h3></div></div></div>
+<p>
+ Mixed precision arithmetic is fully supported by the library, there are two
+ different forms:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ Where the operands are of different precision.
+ </li>
+<li class="listitem">
+ Where the operands are of the same precision, but yield a higher precision
+ result.
+ </li>
+</ul></div>
+<h5>
+<a name="boost_multiprecision.tut.mixed.h0"></a>
+ <span class="phrase"><a name="boost_multiprecision.tut.mixed.mixing_operands_of_differing_precision"></a></span><a class="link" href="mixed.html#boost_multiprecision.tut.mixed.mixing_operands_of_differing_precision">Mixing
+ Operands of Differing Precision</a>
+ </h5>
+<p>
+ If the arguments to a binary operator are of different precision, then the
+ operation is allowed as long as there is an unambiguous implicit conversion
+ from one argument type to the other. In all cases the arithmetic is performed
+ "as if" the lower precision type is promoted to the higher precision
+ type before applying the operator. However, particular backends may optimise
+ this and avoid actually creating a temporary if they are able to do so.
+ </p>
+<p>
+ For example:
+ </p>
+<pre class="programlisting"><span class="identifier">mpfr_float_50</span> <span class="identifier">a</span><span class="special">(</span><span class="number">2</span><span class="special">),</span> <span class="identifier">b</span><span class="special">;</span>
+<span class="identifier">mpfr_float_100</span> <span class="identifier">c</span><span class="special">(</span><span class="number">3</span><span class="special">),</span> <span class="identifier">d</span><span class="special">;</span>
+<span class="identifier">static_mpfr_float_50</span> <span class="identifier">e</span><span class="special">(</span><span class="number">5</span><span class="special">),</span> <span class="identifier">f</span><span class="special">;</span>
+<span class="identifier">mpz_int</span> <span class="identifier">i</span><span class="special">(</span><span class="number">20</span><span class="special">);</span>
+
+<span class="identifier">d</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">*</span> <span class="identifier">c</span><span class="special">;</span> <span class="comment">// OK, result of operand is an mpfr_float_100.</span>
+<span class="identifier">b</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">*</span> <span class="identifier">c</span><span class="special">;</span> <span class="comment">// Error, can't convert the result to an mpfr_float_50 as it will lose digits.</span>
+<span class="identifier">f</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">*</span> <span class="identifier">e</span><span class="special">;</span> <span class="comment">// Error, operator is ambiguous, result could be of either type.</span>
+<span class="identifier">f</span> <span class="special">=</span> <span class="identifier">e</span> <span class="special">*</span> <span class="identifier">i</span><span class="special">;</span> <span class="comment">// OK, unambiguous conversion from mpz_int to static_mpfr_float_50</span>
+</pre>
+<h5>
+<a name="boost_multiprecision.tut.mixed.h1"></a>
+ <span class="phrase"><a name="boost_multiprecision.tut.mixed.operands_of_the_same_precision"></a></span><a class="link" href="mixed.html#boost_multiprecision.tut.mixed.operands_of_the_same_precision">Operands
+ of the Same Precision</a>
+ </h5>
+<p>
+ Sometimes you want to apply an operator to two arguments of the same precision
+ in such a way as to obtain a result of higher precision. The most common
+ situation occurs with fixed precision integers, where you want to multiply
+ two N-bit numbers to obtain a 2N-bit result. This is supported in this library
+ by the following free functions:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">subtract</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</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">ResultType</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Source1</span> <span class="keyword">class</span> <span class="identifier">Source2</span><span class="special">></span>
+<span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ResultType</span><span class="special">&</span> <span class="identifier">result</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source1</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Source2</span><span class="special">&</span> <span class="identifier">b</span><span class="special">);</span>
+</pre>
+<p>
+ These functions apply the named operator to the arguments <span class="emphasis"><em>a</em></span>
+ and <span class="emphasis"><em>b</em></span> and store the result in <span class="emphasis"><em>result</em></span>,
+ returning <span class="emphasis"><em>result</em></span>. In all cases they behave "as
+ if" arguments <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span> were
+ first promoted to type <code class="computeroutput"><span class="identifier">ResultType</span></code>
+ before applying the operator, though particular backends may well avoid that
+ step by way of an optimization.
+ </p>
+<p>
+ The type <code class="computeroutput"><span class="identifier">ResultType</span></code> must
+ be an instance of class <code class="computeroutput"><span class="identifier">number</span></code>,
+ and the types <code class="computeroutput"><span class="identifier">Source1</span></code> and
+ <code class="computeroutput"><span class="identifier">Source2</span></code> may be either instances
+ of class <code class="computeroutput"><span class="identifier">number</span></code> or native
+ integer types. The latter is an optimization that allows arithmetic to be
+ performed on native integer types producing an extended precision result.
+ </p>
+<p>
+ For example:
+ </p>
+<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">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span><span class="special">>::</span><span class="identifier">max</span><span class="special">)();</span>
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+
+<span class="identifier">uint128_t</span> <span class="identifier">ui128</span><span class="special">;</span>
+<span class="identifier">uint256_t</span> <span class="identifier">ui256</span><span class="special">;</span>
+<span class="comment">//</span>
+<span class="comment">// Start by performing arithmetic on 64-bit integers to yield 128-bit results:</span>
+<span class="comment">//</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">std</span><span class="special">::</span><span class="identifier">showbase</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">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">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">j</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">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">i</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="comment">//</span>
+<span class="comment">// The try squaring a 128-bit integer to yield a 256-bit result:</span>
+<span class="comment">//</span>
+<span class="identifier">ui128</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">uint128_t</span><span class="special">>::</span><span class="identifier">max</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">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui256</span><span class="special">,</span> <span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">ui128</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>
+</pre>
+<p>
+ </p>
+<p>
+ Produces the output:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="number">0</span><span class="identifier">xffffffffffffffff</span>
+<span class="number">0</span><span class="identifier">x10000000000000000</span>
+<span class="number">0</span><span class="identifier">xFFFFFFFFFFFFFFFE0000000000000001</span>
+<span class="number">0</span><span class="identifier">xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000000000000000000000001</span>
+</pre>
+<p>
+ </p>
+<h5>
+<a name="boost_multiprecision.tut.mixed.h2"></a>
+ <span class="phrase"><a name="boost_multiprecision.tut.mixed.backends_with_optimized_mixed_precision_arithmetic"></a></span><a class="link" href="mixed.html#boost_multiprecision.tut.mixed.backends_with_optimized_mixed_precision_arithmetic">Backends
+ With Optimized Mixed Precision Arithmetic</a>
+ </h5>
+<p>
+ The following backends have at least some direct support for mixed precision
+ arithmetic, and therefore avoid creating unnecessary temporaries when using
+ the interfaces above. Therefore when using these types it's more efficient
+ to use mixed precision arithmetic, than it is to explicitly cast the operands
+ to the result type:
+ </p>
+<p>
+ <a class="link" href="floats/mpfr_float.html" title="mpfr_float">mpfr_float</a>,
+ <a class="link" href="floats/gmp_float.html" title="gmp_float">gmp_float</a>,
+ <a class="link" href="ints/cpp_int.html" title="cpp_int">cpp_int</a>.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="rounding.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rounding.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rounding.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rounding.html 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -7,11 +7,11 @@
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../tut.html" title="Tutorial">
<link rel="prev" href="lits.html" title="Literal Types and constexpr Support">
-<link rel="next" href="../ref.html" title="Reference">
+<link rel="next" href="mixed.html" title="Mixed Precision Arithmetic">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="spirit-nav">
-<a accesskey="p" href="lits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="lits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="mixed.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section boost_multiprecision_tut_rounding">
<div class="titlepage"><div><div><h3 class="title">
@@ -176,7 +176,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="lits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="lits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="mixed.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
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-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -78,6 +78,7 @@
<dt><span class="section">Literal Types and constexpr
Support</span></dt>
<dt><span class="section"><a href="boost_multiprecision/tut/rounding.html">Rounding Rules for
Conversions</a></span></dt>
+<dt><span class="section">Mixed Precision Arithmetic</span></dt>
</dl></dd>
<dt><span class="section">Reference</span></dt>
<dd><dl>
@@ -124,7 +125,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: November 02, 2012 at 13:02:30 GMT</small></p></td>
+<td align="left"><p><small>Last revised: November 03, 2012 at 18:24:27 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-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -26,6 +26,7 @@
[import ../example/cpp_int_snips.cpp]
[import ../example/random_snips.cpp]
[import ../example/safe_prime.cpp]
+[import ../example/mixed_integer_arithmetic.cpp]
[template mpfr[] [@http://www.mpfr.org MPFR]]
[template gmp[] [@http://gmplib.org GMP]]
@@ -1248,6 +1249,78 @@
[endsect]
+[section:mixed Mixed Precision Arithmetic]
+
+Mixed precision arithmetic is fully supported by the library, there are two different forms:
+
+* Where the operands are of different precision.
+* Where the operands are of the same precision, but yield a higher precision result.
+
+[h4 Mixing Operands of Differing Precision]
+
+If the arguments to a binary operator are of different precision, then the operation is allowed
+as long as there is an unambiguous implicit conversion from one argument type to the other.
+In all cases the arithmetic is performed "as if" the lower precision type is promoted to the
+higher precision type before applying the operator. However, particular backends may optimise
+this and avoid actually creating a temporary if they are able to do so.
+
+For example:
+
+ mpfr_float_50 a(2), b;
+ mpfr_float_100 c(3), d;
+ static_mpfr_float_50 e(5), f;
+ mpz_int i(20);
+
+ d = a * c; // OK, result of operand is an mpfr_float_100.
+ b = a * c; // Error, can't convert the result to an mpfr_float_50 as it will lose digits.
+ f = a * e; // Error, operator is ambiguous, result could be of either type.
+ f = e * i; // OK, unambiguous conversion from mpz_int to static_mpfr_float_50
+
+[h4 Operands of the Same Precision]
+
+Sometimes you want to apply an operator to two arguments of the same precision in
+such a way as to obtain a result of higher precision. The most common situation
+occurs with fixed precision integers, where you want to multiply two N-bit numbers
+to obtain a 2N-bit result. This is supported in this library by the following
+free functions:
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& add(ResultType& result, const Source1& a, const Source2& b);
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& subtract(ResultType& result, const Source1& a, const Source2& b);
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& multiply(ResultType& result, const Source1& a, const Source2& b);
+
+These functions apply the named operator to the arguments ['a] and ['b] and store the
+result in ['result], returning ['result]. In all cases they behave "as if"
+arguments ['a] and ['b] were first promoted to type `ResultType` before applying the
+operator, though particular backends may well avoid that step by way of an optimization.
+
+The type `ResultType` must be an instance of class `number`, and the types `Source1` and `Source2`
+may be either instances of class `number` or native integer types. The latter is an optimization
+that allows arithmetic to be performed on native integer types producing an extended precision result.
+
+For example:
+
+[mixed_eg]
+
+Produces the output:
+
+[mixed_output]
+
+[h4 Backends With Optimized Mixed Precision Arithmetic]
+
+The following backends have at least some direct support for mixed precision arithmetic,
+and therefore avoid creating unnecessary temporaries when using the interfaces above.
+Therefore when using these types it's more efficient to use mixed precision arithmetic,
+than it is to explicitly cast the operands to the result type:
+
+__mpfr_float_backend, __mpf_float, __cpp_int.
+
+[endsect]
+
[endsect]
[section:ref Reference]
@@ -1350,6 +1423,14 @@
template <class Backend, expression_template_option ExpressionTemplates>
std::istream& operator >> (std::istream& is, number<Backend, ExpressionTemplates>& r);
+ // Arithmetic with a higher precision result:
+ template <class ResultType, class Source1 class Source2>
+ ResultType& add(ResultType& result, const Source1& a, const Source2& b);
+ template <class ResultType, class Source1 class Source2>
+ ResultType& subtract(ResultType& result, const Source1& a, const Source2& b);
+ template <class ResultType, class Source1 class Source2>
+ ResultType& multiply(ResultType& result, const Source1& a, const Source2& b);
+
// Non-member function standard library support:
``['unmentionable-expression-template-type]`` abs (const ``['number-or-expression-template-type]``&);
``['unmentionable-expression-template-type]`` fabs (const ``['number-or-expression-template-type]``&);
@@ -1659,6 +1740,26 @@
It's down to the back-end type to actually implement string conversion. However, the back-ends provided with
this library support all of the iostream formatting flags, field width and precision settings.
+[h4 Arithmetic with a higher precision result]
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& add(ResultType& result, const Source1& a, const Source2& b);
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& subtract(ResultType& result, const Source1& a, const Source2& b);
+
+ template <class ResultType, class Source1 class Source2>
+ ResultType& multiply(ResultType& result, const Source1& a, const Source2& b);
+
+These functions apply the named operator to the arguments ['a] and ['b] and store the
+result in ['result], returning ['result]. In all cases they behave "as if"
+arguments ['a] and ['b] were first promoted to type `ResultType` before applying the
+operator, though particular backends may well avoid that step by way of an optimization.
+
+The type `ResultType` must be an instance of class `number`, and the types `Source1` and `Source2`
+may be either instances of class `number` or native integer types. The latter is an optimization
+that allows arithmetic to be performed on native integer types producing an extended precision result.
+
[h4 Non-member standard library function support]
``['unmentionable-expression-template-type]`` abs (const ``['number-or-expression-template-type]``&);
@@ -2925,6 +3026,8 @@
* Tweaked expression template unpacking to use fewer temporaries when the LHS also appears in the RHS.
* Refactored `cpp_int_backend` based on review comments with new template parameter structure.
* Added additional template parameter to `mpfr_float_backend` to allow stack-based allocation.
+* Added section on mixed precision arithmetic, and added support for operations yielding a higher precision result
+than either of the arguments.
[h4 Pre-review history]
Added: sandbox/big_number/libs/multiprecision/example/mixed_integer_arithmetic.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/example/mixed_integer_arithmetic.cpp 2012-11-03 14:27:11 EDT (Sat, 03 Nov 2012)
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+//
+// Compare arithmetic results using fixed_int to GMP results.
+//
+
+#ifdef _MSC_VER
+# define _SCL_SECURE_NO_WARNINGS
+#endif
+
+#include <boost/multiprecision/cpp_int.hpp>
+
+int main()
+{
+ //[mixed_eg
+ //=#include <boost/multiprecision/cpp_int.hpp>
+
+ using namespace boost::multiprecision;
+
+ boost::uint64_t i = (std::numeric_limits<boost::uint64_t>::max)();
+ boost::uint64_t j = 1;
+
+ uint128_t ui128;
+ uint256_t ui256;
+ //
+ // Start by performing arithmetic on 64-bit integers to yield 128-bit results:
+ //
+ std::cout << std::hex << std::showbase << i << std::endl;
+ std::cout << std::hex << std::showbase << add(ui128, i, j) << std::endl;
+ std::cout << std::hex << std::showbase << multiply(ui128, i, i) << std::endl;
+ //
+ // The try squaring a 128-bit integer to yield a 256-bit result:
+ //
+ ui128 = (std::numeric_limits<uint128_t>::max)();
+ std::cout << std::hex << std::showbase << multiply(ui256, ui128, ui128) << std::endl;
+
+ //]
+
+ return 0;
+}
+
+/*
+
+Program output:
+
+//[mixed_output
+
+0xffffffffffffffff
+0x10000000000000000
+0xFFFFFFFFFFFFFFFE0000000000000001
+0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000000000000000000000001
+
+//]
+*/
+
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