Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50647 - in sandbox/mp_math: boost/mp_math/mp_int libs/mp_math/doc libs/mp_math/doc/html libs/mp_math/doc/html/mp_int libs/mp_math/doc/html/mp_int_ libs/mp_math/test
From: baraclese_at_[hidden]
Date: 2009-01-16 18:53:23


Author: baraclese
Date: 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
New Revision: 50647
URL: http://svn.boost.org/trac/boost/changeset/50647

Log:
Updated documentation.

Added:
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/bibliography.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/implementation_notes.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_reference.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_traits_reference.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/performance.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/primality_tests_reference.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/tutorial.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_bits_reference.html (contents, props changed)
   sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_reference.html (contents, props changed)
Removed:
   sandbox/mp_math/libs/mp_math/doc/html/mp_int_/
Text files modified:
   sandbox/mp_math/boost/mp_math/mp_int/operators.hpp | 34 +-
   sandbox/mp_math/libs/mp_math/doc/html/index.html | 74 +++---
   sandbox/mp_math/libs/mp_math/doc/mp_int.qbk | 6
   sandbox/mp_math/libs/mp_math/doc/mp_int_reference.qbk | 397 ++++++++++++++++-----------------------
   sandbox/mp_math/libs/mp_math/doc/primality_tests_reference.qbk | 4
   sandbox/mp_math/libs/mp_math/test/integral_ops.cpp | 7
   6 files changed, 233 insertions(+), 289 deletions(-)

Modified: sandbox/mp_math/boost/mp_math/mp_int/operators.hpp
==============================================================================
--- sandbox/mp_math/boost/mp_math/mp_int/operators.hpp (original)
+++ sandbox/mp_math/boost/mp_math/mp_int/operators.hpp 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -1,4 +1,4 @@
-// Copyright Kevin Sopp 2008.
+// Copyright Kevin Sopp 2008 - 2009.
 // 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)
@@ -32,7 +32,7 @@
     return true;
   if (lhs.size() > rhs.size())
     return false;
-
+
   if (lhs.is_negative())
     return std::lexicographical_compare(
       rhs.rbegin(), rhs.rend(), lhs.rbegin(), lhs.rend());
@@ -136,7 +136,7 @@
 inline bool
 operator >= (const mp_int<A,T>& lhs, const charT* rhs) { return lhs >= mp_int<A,T>(rhs); }
 
-// compare const char* to mp_int
+// compare const charT* to mp_int
 template<class A, class T, typename charT>
 inline bool
 operator == (const charT* lhs, const mp_int<A,T>& rhs) { return mp_int<A,T>(lhs) == rhs; }
@@ -260,7 +260,7 @@
 
   /* shift any bit count < valid_bits */
   const digit_type d = static_cast<digit_type>(b % valid_bits);
-
+
   if (d)
   {
     /* bitmask for carries */
@@ -281,7 +281,7 @@
       /* set the carry to the carry bits of the current word */
       carry = carry_cur;
     }
-
+
     if (carry)
       push(carry);
   }
@@ -368,16 +368,16 @@
     {
       grow_capacity(rhs.size_);
       // result has opposite sign from *this
- set_sign(is_positive() ? -1 : 1);
+ set_sign(is_positive() ? -1 : 1);
       x = &rhs;
       y = this;
     }
-
+
     ops_type::sub_smaller_magnitude(digits_, x->digits_, x->size_,
                                              y->digits_, y->size_);
 
     size_ = x->size_;
-
+
     clamp();
 
     if (!*this)
@@ -394,7 +394,7 @@
     sqr();
     return *this;
   }
-
+
   const int neg = (sign() == rhs.sign()) ? 1 : -1;
   const size_type min = std::min(size_, rhs.size_);
 
@@ -406,7 +406,7 @@
   {
     mp_int tmp;
     tmp.grow_capacity(size_ + rhs.size_);
-
+
     if (size_ == rhs.size_)
       ops_type::comba_mul(tmp.digits(), digits(), rhs.digits(), size_);
     else
@@ -466,13 +466,13 @@
     px = size_;
     x = this;
   }
-
+
   for (size_type i = 0; i < px; ++i)
     tmp[i] |= (*x)[i];
-
+
   tmp.clamp();
   swap(tmp);
-
+
   return *this;
 }
 
@@ -498,12 +498,12 @@
 
   for (size_type i = 0; i < px; ++i)
     tmp[i] &= (*x)[i];
-
+
   /* zero digits above the last from the smallest mp_int */
   std::memset(tmp.digits_ + px, 0, (tmp.size_ - px) * sizeof(digit_type));
   tmp.clamp();
   swap(tmp);
-
+
   return *this;
 }
 
@@ -529,10 +529,10 @@
 
   for (size_type i = 0; i < px; ++i)
     tmp[i] ^= (*x)[i];
-
+
   tmp.clamp();
   swap(tmp);
-
+
   return *this;
 }
 

Modified: sandbox/mp_math/libs/mp_math/doc/html/index.html
==============================================================================
--- sandbox/mp_math/libs/mp_math/doc/html/index.html (original)
+++ sandbox/mp_math/libs/mp_math/doc/html/index.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -3,9 +3,9 @@
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Chapter 1. mp_int</title>
 <link rel="stylesheet" href="boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
-<link rel="start" href="index.html" title="Chapter 1. mp_int">
-<link rel="next" href="mp_int_/tutorial.html" title="Tutorial">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="index.html" title="Chapter 1. mp_int">
+<link rel="next" href="mp_int/tutorial.html" title="Tutorial">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%"><tr>
@@ -17,62 +17,64 @@
 <td align="center">More</td>
 </tr></table>
 <hr>
-<div class="spirit-nav"><a accesskey="n" href="mp_int_/tutorial.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="mp_int/tutorial.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
 <div class="chapter" lang="en">
 <div class="titlepage"><div>
 <div><h2 class="title">
-<a name="mp_int"></a>Chapter 1. mp_int </h2></div>
+<a name="mp_int"></a>Chapter 1. mp_int</h2></div>
 <div><div class="author"><h3 class="author">
 <span class="firstname">Kevin</span> <span class="surname">Sopp</span>
 </h3></div></div>
-<div><p class="copyright">Copyright © 2008 Kevin Sopp</p></div>
+<div><p class="copyright">Copyright © 2008 - 2009 Kevin Sopp</p></div>
 <div><div class="legalnotice">
-<a name="id2693145"></a><p>
- All code and documentation is in the public domain
+<a name="id3102140"></a><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
+ [source-mode c++
       </p>
 </div></div>
 </div></div>
 <div class="toc">
 <p><b>Table of Contents</b></p>
 <dl>
-<dt><span class="section">Introduction</span></dt>
-<dt><span class="section">Tutorial</span></dt>
+<dt><span class="section">Introduction</span></dt>
+<dt><span class="section">Tutorial</span></dt>
 <dd><dl>
-<dt><span class="section">General use</span></dt>
-<dt><span class="section"><a href="mp_int_/tutorial.html#mp_int_.tutorial.random_number_generation">Random number
+<dt><span class="section">General use</span></dt>
+<dt><span class="section"><a href="mp_int/tutorial.html#mp_int.tutorial.random_number_generation">Random number
       generation</a></span></dt>
-<dt><span class="section">Primality testing</span></dt>
-<dt><span class="section"><a href="mp_int_/tutorial.html#mp_int_.tutorial.prime_number_generation">Prime number
+<dt><span class="section">Primality testing</span></dt>
+<dt><span class="section"><a href="mp_int/tutorial.html#mp_int.tutorial.prime_number_generation">Prime number
       generation</a></span></dt>
 </dl></dd>
-<dt><span class="section">Performance</span></dt>
+<dt><span class="section">Performance</span></dt>
 <dd><dl>
-<dt><span class="section">Tips</span></dt>
-<dt><span class="section">Measurements</span></dt>
+<dt><span class="section">Tips</span></dt>
+<dt><span class="section">Measurements</span></dt>
 </dl></dd>
-<dt><span class="section">Implementation notes</span></dt>
+<dt><span class="section">Implementation notes</span></dt>
 <dd><dl>
-<dt><span class="section"><a href="mp_int_/implementation_notes.html#mp_int_.implementation_notes.mp_int_structure">mp_int
+<dt><span class="section"><a href="mp_int/implementation_notes.html#mp_int.implementation_notes.mp_int_structure">mp_int
       structure</a></span></dt>
-<dt><span class="section">Semantics</span></dt>
+<dt><span class="section">Semantics</span></dt>
 </dl></dd>
-<dt><span class="section">mp_int reference</span></dt>
-<dt><span class="section">mp_int_traits reference</span></dt>
-<dt><span class="section">uniform_mp_int reference</span></dt>
-<dt><span class="section"><a href="mp_int_/uniform_mp_int_bits_reference.html">uniform_mp_int_bits
+<dt><span class="section">mp_int reference</span></dt>
+<dt><span class="section">mp_int_traits reference</span></dt>
+<dt><span class="section">uniform_mp_int reference</span></dt>
+<dt><span class="section"><a href="mp_int/uniform_mp_int_bits_reference.html">uniform_mp_int_bits
     reference</a></span></dt>
-<dt><span class="section">Primality Tests reference</span></dt>
+<dt><span class="section">Primality Tests reference</span></dt>
 <dd><dl>
-<dt><span class="section">primality_division_test</span></dt>
-<dt><span class="section">primality_fermat_test</span></dt>
-<dt><span class="section">primality_miller_rabin_test</span></dt>
+<dt><span class="section">primality_division_test</span></dt>
+<dt><span class="section">primality_fermat_test</span></dt>
+<dt><span class="section">primality_miller_rabin_test</span></dt>
 </dl></dd>
-<dt><span class="section">Bibliography</span></dt>
+<dt><span class="section">Bibliography</span></dt>
 </dl>
 </div>
 <div class="section" lang="en">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="mp_int_.introduction"></a><a class="link" href="index.html#mp_int_.introduction" title="Introduction">Introduction</a>
+<a name="mp_int.introduction"></a><a class="link" href="index.html#mp_int.introduction" title="Introduction">Introduction</a>
 </h2></div></div></div>
 <p>
       This library provides the <code class="computeroutput"><span class="identifier">mp_int</span></code>
@@ -81,9 +83,9 @@
       for the implementation of public key cryptography such as prime generation
       are provided.
     </p>
-<a name="mp_int_.introduction.acknowledgement"></a><h4>
-<a name="id2733685"></a>
- <a class="link" href="index.html#mp_int_.introduction.acknowledgement">Acknowledgement</a>
+<a name="mp_int.introduction.acknowledgement"></a><h4>
+<a name="id3141691"></a>
+ <a class="link" href="index.html#mp_int.introduction.acknowledgement">Acknowledgement</a>
     </h4>
 <p>
       This library originally started as a port of the C code of libtommath. Without
@@ -96,14 +98,12 @@
       domain</strong></span> as well.
     </p>
 </div>
-<p>
- </p>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: October 06, 2008 at 11:40:14 GMT</small></p></td>
+<td align="left"><p><small>Last revised: January 16, 2009 at 23:54:32 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>
-<div class="spirit-nav"><a accesskey="n" href="mp_int_/tutorial.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="mp_int/tutorial.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a></div>
 </body>
 </html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/bibliography.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/bibliography.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,73 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Bibliography</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="primality_tests_reference.html" title="Primality Tests reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primality_tests_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.bibliography"></a><a class="link" href="bibliography.html" title="Bibliography">Bibliography</a>
+</h2></div></div></div>
+<a name="mp_int.bibliography.gmp__gnu_multiple_precision_arithmetic_library_"></a><h4>
+<a name="id3197812"></a>
+ <a class="link" href="bibliography.html#mp_int.bibliography.gmp__gnu_multiple_precision_arithmetic_library_">GMP
+ (GNU Multiple Precision Arithmetic Library)</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc"><li>http://gmplib.org/</li></ul></div>
+<a name="mp_int.bibliography.handbook_of_applied_cryptogtaphy"></a><h4>
+<a name="id3197847"></a>
+ <a class="link" href="bibliography.html#mp_int.bibliography.handbook_of_applied_cryptogtaphy">Handbook
+ of Applied Cryptogtaphy</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc"><li>http://www.cacr.math.uwaterloo.ca/hac/</li></ul></div>
+<a name="mp_int.bibliography.libtommath"></a><h4>
+<a name="id3197881"></a>
+ <a class="link" href="bibliography.html#mp_int.bibliography.libtommath">libtommath</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc">
+<li>
+http://libtom.org/<code class="computeroutput"><span class="comment">// this link seems to be down lately (10/26/2008)</span></code>
+</li>
+<li>
+http://math.libtomcrypt.com/<code class="computeroutput"><span class="comment">// this works but is out of date</span></code>
+</li>
+</ul></div>
+<a name="mp_int.bibliography.miller_rabin_primality_test"></a><h4>
+<a name="id3197947"></a>
+ <a class="link" href="bibliography.html#mp_int.bibliography.miller_rabin_primality_test">Miller-Rabin
+ Primality Test</a>
+ </h4>
+<div class="itemizedlist"><ul type="disc"><li>http://www.bitnuts.de/rienhardt/docs/miller_rabin.pdf</li></ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="primality_tests_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/implementation_notes.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/implementation_notes.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,100 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Implementation notes</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="performance.html" title="Performance">
+<link rel="next" href="mp_int_reference.html" title="mp_int reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mp_int_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.implementation_notes"></a><a class="link" href="implementation_notes.html" title="Implementation notes">Implementation notes</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="implementation_notes.html#mp_int.implementation_notes.mp_int_structure">mp_int
+ structure</a></span></dt>
+<dt><span class="section">Semantics</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.implementation_notes.mp_int_structure"></a><a class="link" href="implementation_notes.html#mp_int.implementation_notes.mp_int_structure" title="mp_int structure">mp_int
+ structure</a>
+</h3></div></div></div>
+<p>
+ An <code class="computeroutput"><span class="identifier">mp_int</span></code> is handled in a
+ sign plus magnitude representation which looks like this:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">mp_int</span>
+<span class="special">{</span>
+ <span class="identifier">digit_type</span><span class="special">*</span> <span class="identifier">digits_</span><span class="special">;</span>
+ <span class="identifier">size_type</span> <span class="identifier">used_</span><span class="special">,</span> <span class="identifier">capacity_</span><span class="special">;</span>
+ <span class="keyword">int</span> <span class="identifier">sign_</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The least significant digit of the number always lives at <code class="computeroutput"><span class="identifier">digits_</span><span class="special">[</span><span class="number">0</span><span class="special">]</span></code>
+ while the most significant lives at <code class="computeroutput"><span class="identifier">digits_</span><span class="special">[</span><span class="identifier">used_</span> <span class="special">-</span> <span class="number">1</span><span class="special">]</span></code>.
+ </p>
+<p>
+ Libtommath on which this code is ultimately based chose a <code class="computeroutput"><span class="identifier">digit_type</span></code>
+ representation which does not use all of its bits, instead some bits are
+ reserved to hold carries in intermediate results. This allows very fast multiplication
+ routines. I chose a different representation which uses all the bits in the
+ <code class="computeroutput"><span class="identifier">digit_type</span></code> but needs explicit
+ carry handling in the code. This makes normal c++ code a tad slower. However
+ it makes it much easier to write assembler routines since most CPUs provide
+ instructions that allow the handling of carries in place. This is what GMP
+ does as well. It is possible that a <code class="computeroutput"><span class="identifier">digit_type</span></code>
+ representation similar to libtommath's returns someday which can then be
+ enabled via a different <code class="computeroutput"><span class="identifier">mp_int_traits</span></code>
+ class template.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.implementation_notes.semantics"></a><a class="link" href="implementation_notes.html#mp_int.implementation_notes.semantics" title="Semantics">Semantics</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ An integer with a value of zero has a <code class="computeroutput"><span class="identifier">used_</span></code>
+ count of 1 and <code class="computeroutput"><span class="identifier">digits_</span><span class="special">[</span><span class="number">0</span><span class="special">]</span></code>
+ holds the value 0.
+ </li>
+<li>
+ An unitialized integer has no value and all operations on it except for
+ initializing or swapping are undefined.
+ </li>
+</ul></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mp_int_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_reference.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_reference.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,2057 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>mp_int reference</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="implementation_notes.html" title="Implementation notes">
+<link rel="next" href="mp_int_traits_reference.html" title="mp_int_traits reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="implementation_notes.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mp_int_traits_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.mp_int_reference"></a><a class="link" href="mp_int_reference.html" title="mp_int reference">mp_int reference</a>
+</h2></div></div></div>
+<a name="mp_int.mp_int_reference.synopsis"></a><h4>
+<a name="id3153688"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.synopsis">Synopsis</a>
+ </h4>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+<span class="keyword">namespace</span> <span class="identifier">mp_math</span> <span class="special">{</span>
+
+<span class="keyword">template</span><span class="special">&lt;</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">&lt;</span><span class="keyword">void</span><span class="special">&gt;,</span>
+ <span class="keyword">class</span> <span class="identifier">Traits</span> <span class="special">=</span> <span class="identifier">mp_int_traits</span><span class="special">&lt;&gt;</span>
+<span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">mp_int</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">Allocator</span> <span class="identifier">allocator_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">Traits</span> <span class="identifier">traits_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">base_allocator_type</span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">size_type</span><span class="special">;</span>
+
+ <span class="comment">// ctor/cctor/dtor/assign
+</span> <span class="identifier">mp_int</span><span class="special">();</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">(),</span>
+ <span class="keyword">typename</span> <span class="identifier">enable_if</span><span class="special">&lt;</span><span class="identifier">is_integral</span><span class="special">&lt;</span><span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="identifier">dummy</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span>
+ <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span>
+ <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">copy</span><span class="special">);</span>
+
+ <span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_HAS_RVALUE_REFS</span>
+ <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">copy</span><span class="special">);</span>
+ <span class="preprocessor">#endif</span>
+
+ <span class="special">~</span><span class="identifier">mp_int</span><span class="special">();</span>
+
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_HAS_RVALUE_REFS</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+ <span class="preprocessor">#endif</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">rhs</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">);</span>
+
+ <span class="comment">// modifiers
+</span> <span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_HAS_RVALUE_REFS</span>
+ <span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">other</span><span class="special">);</span>
+ <span class="preprocessor">#else</span>
+ <span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">other</span><span class="special">);</span>
+ <span class="preprocessor">#endif</span>
+
+ <span class="comment">// increment/decrement
+</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">++();</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">--();</span>
+ <span class="identifier">mp_int</span> <span class="keyword">operator</span> <span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
+ <span class="identifier">mp_int</span> <span class="keyword">operator</span> <span class="special">--(</span><span class="keyword">int</span><span class="special">);</span>
+
+ <span class="comment">// shifting
+</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&lt;&lt;=</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&gt;&gt;=</span> <span class="special">(</span><span class="identifier">size_type</span><span class="special">);</span>
+
+ <span class="comment">// unary negate
+</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">();</span>
+
+ <span class="comment">// arithmetic operators
+</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+ <span class="comment">// bitwise operators
+</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+ <span class="comment">// operators involving integral types
+</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+
+ <span class="comment">// operators involving character strings
+</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+ <span class="comment">// operators involving std::basic_string
+</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+ <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+
+ <span class="comment">// observers
+</span> <span class="identifier">allocator_type</span> <span class="identifier">get_allocator</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">bool</span> <span class="identifier">is_even</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">is_odd</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">bool</span> <span class="identifier">is_positive</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">is_negative</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="identifier">size_type</span> <span class="identifier">precision</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">operator</span> <span class="identifier">unspecified_bool_type</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">to_string</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">dec</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+ <span class="identifier">IntegralT</span> <span class="identifier">to_integral</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="comment">// low level access
+</span> <span class="keyword">typedef</span> <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">digit_type</span> <span class="identifier">digit_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">word_type</span> <span class="identifier">word_type</span><span class="special">;</span>
+
+ <span class="identifier">digit_type</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span> <span class="identifier">i</span><span class="special">);</span>
+ <span class="keyword">const</span> <span class="identifier">digit_type</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">size_type</span> <span class="identifier">i</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="identifier">digit_type</span><span class="special">&amp;</span> <span class="identifier">at</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">i</span><span class="special">);</span>
+ <span class="keyword">const</span> <span class="identifier">digit_type</span><span class="special">&amp;</span> <span class="identifier">at</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">i</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+<span class="special">};</span>
+
+
+<span class="comment">// non-member functions
+</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_HAS_RVALUE_REFS</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;&amp;,</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;&amp;);</span>
+<span class="preprocessor">#else</span>
+<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+<span class="preprocessor">#endif</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">size_type</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&gt;&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">size_type</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">+</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">*</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">/</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">%</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">|</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">^</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">+</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">*</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">/</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">%</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">|</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">^</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+
+<span class="comment">// Comparison operators
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="comment">// Comparison between mp_int and std::basic_string
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="comment">// Comparison between std::basic_string and mp_int
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="comment">// Comparison between mp_int and const charT*
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="comment">// Comparison between const charT* and mp_int
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="comment">// Comparison between mp_int and integral type
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="comment">// Comparison between integral type and mp_int
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+
+<span class="comment">// Stream I/O
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">&gt;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span>
+<span class="keyword">operator</span> <span class="special">&gt;&gt;</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">&gt;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span>
+<span class="keyword">operator</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+
+<span class="comment">// Special functions
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">abs</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">gcd</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">b</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">lcm</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">b</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">int</span> <span class="identifier">jacobi</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">pow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digit_type</span> <span class="identifier">n</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">pow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">n</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">modpow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">base</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">exp</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span
><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">mod</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">nth_root</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digit_type</span> <span class="identifier">n</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">nth_root</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">n</span><span class="special">);</span>
+
+
+<span class="special">}</span> <span class="comment">// namespace mp_math
+</span><span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<a name="mp_int.mp_int_reference.construction_from___assignment_to_a_string_object"></a><h4>
+<a name="id3169608"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.construction_from___assignment_to_a_string_object">Construction
+ from / assignment to a string object</a>
+ </h4>
+<p>
+ In a constructor or assignment operation without the possibility to specify
+ the base of the string argument the base of the number is deduced from the
+ string. If the string starts with <code class="computeroutput"><span class="number">0</span><span class="identifier">x</span></code> or <code class="computeroutput"><span class="number">0</span><span class="identifier">X</span></code> then the number will be treated as hexadecimal
+ value. If the string starts with <code class="computeroutput"><span class="number">0</span></code>
+ then the number will be treated as octal value else it will be treated as decimal
+ value. An optional <code class="computeroutput"><span class="special">-</span></code> sign is allowed
+ as the first character in the string to indicate a negative value.
+ </p>
+<p>
+ In a constructor or assignment operation with the ability to specify the format
+ of the string argument via a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span></code>
+ parameter, possible formatting flags are:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">showbase</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">dec</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">hex</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">oct</span></code></li>
+</ul></div>
+<a name="mp_int.mp_int_reference.construct_copy_destroy_assign"></a><h4>
+<a name="id3169858"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.construct_copy_destroy_assign">Construct/Copy/Destroy/Assign</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an empty <code class="computeroutput"><span class="identifier">mp_int</span></code> object, such an uninitialized <code class="computeroutput"><span class="identifier">mp_int</span></code> has no value, i.e. it is <span class="emphasis"><em>not</em></span>
+ zero.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an empty <code class="computeroutput"><span class="identifier">mp_int</span></code> object and initializes its allocator
+ with <code class="computeroutput"><span class="identifier">a</span></code>, such an uninitialized
+ <code class="computeroutput"><span class="identifier">mp_int</span></code> has no value, i.e.
+ it is <span class="emphasis"><em>not</em></span> zero.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">(),</span>
+ <span class="keyword">typename</span> <span class="identifier">enable_if</span><span class="special">&lt;</span><span class="identifier">is_integral</span><span class="special">&lt;</span><span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span><span class="special">*</span> <span class="identifier">dummy</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from an integral type. The value of the object is that of the integral
+ type.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N) where N is the number of
+ bits of IntegralT.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ points to a valid number formatted as string or to an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ points to a valid number formatted according to the flags in <code class="computeroutput"><span class="identifier">f</span></code> or <code class="computeroutput"><span class="identifier">s</span></code>
+ is an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ contains a valid number formatted as string or <code class="computeroutput"><span class="identifier">s</span></code>
+ is an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ contains a valid number formatted according to the flags in <code class="computeroutput"><span class="identifier">f</span></code> or <code class="computeroutput"><span class="identifier">s</span></code>
+ is an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span>
+ <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">first</span></code>
+ and <code class="computeroutput"><span class="identifier">last</span></code> are iterators into
+ a string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from two iterators.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span>
+ <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">allocator_type</span><span class="special">&amp;</span> <span class="identifier">a</span> <span class="special">=</span> <span class="identifier">allocator_type</span><span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">first</span></code>
+ and <code class="computeroutput"><span class="identifier">last</span></code> are iterators into
+ a string formatted according to the formatting flags in <code class="computeroutput"><span class="identifier">f</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from two iterators.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">copy</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs a copy of a given <code class="computeroutput"><span class="identifier">mp_int</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N), where N is the number
+ of digits in <code class="computeroutput"><span class="identifier">copy</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">copy</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ by moving <code class="computeroutput"><span class="identifier">copy</span></code> into <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="special">~</span><span class="identifier">mp_int</span><span class="special">();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Destroys <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Copies the value of <code class="computeroutput"><span class="identifier">rhs</span></code> into <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> obtains the value of <code class="computeroutput"><span class="identifier">rhs</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">rhs</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> obtains the value of <code class="computeroutput"><span class="identifier">rhs</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ points to a valid number formatted as string or to an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ points to a valid number formatted as string or to an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">mp_int</span><span class="special">(</span><span class="identifier">s</span><span class="special">);</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ points to a valid number formatted according to the flags in <code class="computeroutput"><span class="identifier">f</span></code> or <code class="computeroutput"><span class="identifier">s</span></code>
+ is an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">s</span></code>
+ contains a valid number formatted according to the flags in <code class="computeroutput"><span class="identifier">f</span></code> or <code class="computeroutput"><span class="identifier">s</span></code>
+ is an empty string.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from a string.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessIterator</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">assign</span><span class="special">(</span><span class="identifier">RandomAccessIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">RandomAccessIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">first</span></code>
+ and <code class="computeroutput"><span class="identifier">last</span></code> are iterators into
+ a string formatted according to the formatting flags in <code class="computeroutput"><span class="identifier">f</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs an <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ object from two iterators.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character or if an unrecognized formatting flag was set.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> basic.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.modifiers"></a><h4>
+<a name="id3173944"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.modifiers">Modifiers</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;&amp;</span> <span class="identifier">other</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Swaps the value of <code class="computeroutput"><span class="identifier">other</span></code> and <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> nothrow.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">other</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Swaps the value of <code class="computeroutput"><span class="identifier">other</span></code> and <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> nothrow.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.increment_decrement"></a><h4>
+<a name="id3174161"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.increment_decrement">Increment/decrement</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">++();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span><pre class="programlisting"><span class="special">*</span><span class="keyword">this</span> <span class="special">+=</span> <span class="number">1</span><span class="special">;</span>
+<span class="keyword">return</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
+</pre>
+</li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> best case is O(1), worst case
+ is O(N) - this happens when the addition causes a carry bit to ripple through
+ all digits subsequently.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">--();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span><pre class="programlisting"><span class="special">*</span><span class="keyword">this</span> <span class="special">-=</span> <span class="number">1</span><span class="special">;</span>
+<span class="keyword">return</span> <span class="special">*</span><span class="keyword">this</span><span class="special">;</span>
+</pre>
+</li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> best case is O(1), worst case
+ is O(N) - this happens when the subtraction causes a borrow bit to ripple
+ through all digits subsequently.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span> <span class="keyword">operator</span> <span class="special">++(</span><span class="keyword">int</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span><pre class="programlisting"><span class="identifier">mp_int</span> <span class="identifier">tmp</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span>
+<span class="special">*</span><span class="keyword">this</span> <span class="special">+=</span> <span class="number">1</span><span class="special">;</span>
+<span class="keyword">return</span> <span class="identifier">tmp</span><span class="special">;</span>
+</pre>
+</li>
+<li>
+<span class="bold"><strong>Returns:</strong></span> The value of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> before incrementation.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span> <span class="keyword">operator</span> <span class="special">--(</span><span class="keyword">int</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span><pre class="programlisting"><span class="identifier">mp_int</span> <span class="identifier">tmp</span><span class="special">(*</span><span class="keyword">this</span><span class="special">);</span>
+<span class="special">*</span><span class="keyword">this</span> <span class="special">-=</span> <span class="number">1</span><span class="special">;</span>
+<span class="keyword">return</span> <span class="identifier">tmp</span><span class="special">;</span>
+</pre>
+</li>
+<li>
+<span class="bold"><strong>Returns:</strong></span> The value of <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> before decrementation.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.shifting"></a><h4>
+<a name="id3174889"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.shifting">Shifting</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&lt;&lt;=</span> <span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Shift <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>
+ bits to the left.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&gt;&gt;=</span> <span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Shift <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>
+ bits to the right.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.unary_negate"></a><h4>
+<a name="id3175224"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.unary_negate">Unary negate</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Negates <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> nothrow.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.arithmetic_operators"></a><h4>
+<a name="id3175350"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.arithmetic_operators">Arithmetic operators</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Adds <code class="computeroutput"><span class="identifier">x</span></code>
+ to <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Subtracts <code class="computeroutput"><span class="identifier">x</span></code>
+ from <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Multiplies <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> If <code class="computeroutput"><span class="special">&amp;</span><span class="identifier">x</span> <span class="special">==</span> <span class="keyword">this</span></code>
+ then a squaring algorithm will be used. Different multiplication algorithms
+ are chosen for numbers of different size. The thresholds can be tuned via
+ the <code class="computeroutput"><span class="identifier">mp_int_traits</span></code> class template
+ parameter.
+ <div class="itemizedlist"><ul type="circle">
+<li>
+ Small numbers: Comba algorithm O(N^2).
+ </li>
+<li>
+ Midsize numbers: Karatsuba algorithm O(N^log2(3)) ~ O(N^1.585).
+ </li>
+<li>
+ Large numbers: Toom-Cook algorithm O(N^(log(5)/log(3))) ~ O(N^1.465).
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">x</span>
+ <span class="special">!=</span> <span class="number">0</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Divides <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> if <code class="computeroutput"><span class="identifier">x</span>
+ <span class="special">==</span> <span class="number">0</span></code>.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">x</span>
+ <span class="special">!=</span> <span class="number">0</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Modulus <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> if <code class="computeroutput"><span class="identifier">x</span>
+ <span class="special">==</span> <span class="number">0</span></code>.
+ </li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.bitwise_operators"></a><h4>
+<a name="id3176409"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.bitwise_operators">Bitwise operators</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> OR <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> AND <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> XOR <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.operators_involving_integral_types"></a><h4>
+<a name="id3176932"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.operators_involving_integral_types">Operators
+ involving integral types</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Adds <code class="computeroutput"><span class="identifier">x</span></code>
+ to <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Subtracts <code class="computeroutput"><span class="identifier">x</span></code>
+ to <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Multiplies <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Divides <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> by <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> modulo <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Applies the bitwise or operation
+ on <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ and the absolute of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Applies the bitwise and operation
+ on <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ and the absolute of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="identifier">IntegralT</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Applies the bitwise xor operation
+ on <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
+ and the absolute of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.operators_involving_chart_strings"></a><h4>
+<a name="id3178345"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.operators_involving_chart_strings">Operators
+ involving charT strings</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span> <span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<a name="mp_int.mp_int_reference.operators_involving_std__basic_string"></a><h4>
+<a name="id3178991"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.operators_involving_std__basic_string">Operators
+ involving std::basic_string</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">%=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">|=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">&amp;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&amp;</span> <span class="keyword">operator</span> <span class="special">^=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">);</span>
+</pre>
+<a name="mp_int.mp_int_reference.observers"></a><h4>
+<a name="id3180185"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.observers">Observers</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">allocator_type</span> <span class="identifier">get_allocator</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns: </strong></span> A copy of the allocator.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing if allocator copy constructor
+ is nothrow.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_even</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_odd</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_positive</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_negative</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">size_type</span> <span class="identifier">precision</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The number of bits used by the
+ absolute value of *this.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(N).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">operator</span> <span class="identifier">unspecified_bool_type</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">!=</span> <span class="number">0</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">to_string</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">dec</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> to a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>,
+ formatting of the string is done according to the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">fmtflags</span></code>
+ parameter. Possible formatting flags are:
+ <div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">showpos</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">showbase</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">dec</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">hex</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">oct</span></code></li>
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">uppercase</span></code></li>
+</ul></div>
+</li>
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> converted to a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
+ object.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">IntegralT</span> <span class="identifier">to_integral</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code> converted to an object of type <code class="computeroutput"><span class="identifier">IntegralT</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">overflow_error</span></code>
+ if <code class="computeroutput"><span class="identifier">IntegralT</span></code> does not have
+ enough precision to hold the result.
+ </li>
+<li>
+<span class="bold"><strong>Exception safety:</strong></span> strong.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.non_member_functions"></a><h4>
+<a name="id3181249"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.non_member_functions">Non-member functions</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;&amp;,</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">size_type</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&gt;&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">size_type</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">+</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">*</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">/</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">%</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">|</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">^</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">+</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">-</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">*</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">/</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">%</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">|</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">operator</span> <span class="special">^</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+</pre>
+<p>
+ These functions are implemented in terms of their respective member functions.
+ </p>
+<a name="mp_int.mp_int_reference.comparison_operators"></a><h4>
+<a name="id3184214"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.comparison_operators">Comparison operators</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> These operators compare the numeric
+ value of their arguments and return a truth value based on that evaluation.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span> Nothing.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the string argument to
+ an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the left side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">Traits</span><span class="special">,</span><span class="identifier">Alloc</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the string argument to
+ an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the right side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the string argument to
+ an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the left side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">charT</span><span class="special">*,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the string argument to
+ an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the right side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">invalid_argument</span></code> if the string contains
+ an invalid character.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;,</span> <span class="identifier">IntegralT</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the integral argument
+ to an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the left side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">!=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&lt;=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">IntegralT</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span> <span class="special">&gt;=</span> <span class="special">(</span><span class="identifier">IntegralT</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Effects:</strong></span> Converts the integral argument
+ to an <code class="computeroutput"><span class="identifier">mp_int</span></code> object and compares
+ it to the object on the right side of the expression.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<a name="mp_int.mp_int_reference.stream_i_o"></a><h4>
+<a name="id3190887"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.stream_i_o">Stream I/O</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">&gt;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span>
+<span class="keyword">operator</span> <span class="special">&gt;&gt;</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span> <span class="identifier">is</span><span class="special">,</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">&gt;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span>
+<span class="keyword">operator</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">traits</span><span class="special">&gt;&amp;</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<a name="mp_int.mp_int_reference.special_functions"></a><h4>
+<a name="id3191347"></a>
+ <a class="link" href="mp_int_reference.html#mp_int.mp_int_reference.special_functions">Special functions</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">abs</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The positive value of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(1).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">gcd</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">b</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The greatest common divisor of
+ <code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O((log2(AB))^2).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">lcm</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">b</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The least common multiple of <code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O((log2(AB))^2).
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">int</span> <span class="identifier">jacobi</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The Jacobi symbol of integer <code class="computeroutput"><span class="identifier">a</span></code> and positive odd integer <code class="computeroutput"><span class="identifier">p</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> if <code class="computeroutput"><span class="identifier">p</span></code>
+ is negative.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">pow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digit_type</span> <span class="identifier">n</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">pow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">n</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The <code class="computeroutput"><span class="identifier">n</span></code>th
+ power of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">modpow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">base</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">exp</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">mod</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns: </strong></span><code class="computeroutput"><span class="special">(</span><span class="identifier">base</span> <span class="special">^</span> <span class="identifier">exp</span><span class="special">)</span> <span class="special">%</span>
+ <span class="identifier">mod</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws: </strong></span><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code>.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The square root of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> if <code class="computeroutput"><span class="identifier">x</span></code>
+ is negative.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">nth_root</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">digit_type</span> <span class="identifier">n</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">nth_root</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">n</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Returns:</strong></span> The <code class="computeroutput"><span class="identifier">n</span></code>th
+ root of <code class="computeroutput"><span class="identifier">x</span></code>.
+ </li>
+<li>
+<span class="bold"><strong>Complexity:</strong></span> O(log(N)).
+ </li>
+<li>
+<span class="bold"><strong>Throws:</strong></span><div class="itemizedlist"><ul type="circle">
+<li><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bad_alloc</span></code></li>
+<li>
+<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> if <code class="computeroutput"><span class="identifier">x</span></code>
+ is negative and <code class="computeroutput"><span class="identifier">n</span></code> is
+ odd.
+ </li>
+</ul></div>
+</li>
+</ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="implementation_notes.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="mp_int_traits_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_traits_reference.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/mp_int_traits_reference.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,80 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>mp_int_traits reference</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="mp_int_reference.html" title="mp_int reference">
+<link rel="next" href="uniform_mp_int_reference.html" title="uniform_mp_int reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="mp_int_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="uniform_mp_int_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.mp_int_traits_reference"></a><a class="link" href="mp_int_traits_reference.html" title="mp_int_traits reference">mp_int_traits reference</a>
+</h2></div></div></div>
+<p>
+ The second template parameter to mp_int is a type which allows to customize
+ some of mp_int's internal workings.
+ </p>
+<a name="mp_int.mp_int_traits_reference.synopsis"></a><h4>
+<a name="id3193705"></a>
+ <a class="link" href="mp_int_traits_reference.html#mp_int.mp_int_traits_reference.synopsis">Synopsis</a>
+ </h4>
+<p>
+
+</p>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int/traits.hpp&gt;
+</span><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+<span class="keyword">namespace</span> <span class="identifier">mp_math</span> <span class="special">{</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">Digit</span> <span class="special">=</span> <span class="identifier">implementation</span> <span class="identifier">defined</span><span class="special">,</span>
+ <span class="keyword">typename</span> <span class="identifier">Word</span> <span class="special">=</span> <span class="identifier">implementation</span> <span class="identifier">defined</span>
+<span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">mp_int_traits</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">size_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">Digit</span> <span class="identifier">digit_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">Word</span> <span class="identifier">word_type</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="identifier">size_type</span> <span class="identifier">toom_mul_cutoff</span><span class="special">;</span> <span class="comment">// default: 350
+</span> <span class="keyword">static</span> <span class="identifier">size_type</span> <span class="identifier">toom_sqr_cutoff</span><span class="special">;</span> <span class="comment">// default: 400
+</span> <span class="keyword">static</span> <span class="identifier">size_type</span> <span class="identifier">karatsuba_mul_cutoff</span><span class="special">;</span> <span class="comment">// default: 80
+</span> <span class="keyword">static</span> <span class="identifier">size_type</span> <span class="identifier">karatsuba_sqr_cutoff</span><span class="special">;</span> <span class="comment">// default: 120
+</span><span class="special">};</span>
+
+<span class="special">}</span> <span class="comment">// namespace mp_math
+</span><span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </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 © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="mp_int_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="uniform_mp_int_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/performance.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/performance.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,230 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Performance</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="tutorial.html" title="Tutorial">
+<link rel="next" href="implementation_notes.html" title="Implementation notes">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="implementation_notes.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.performance"></a><a class="link" href="performance.html" title="Performance">Performance</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Tips</span></dt>
+<dt><span class="section">Measurements</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.performance.tips"></a><a class="link" href="performance.html#mp_int.performance.tips" title="Tips">Tips</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ A statement like
+<pre class="programlisting"><span class="identifier">x</span> <span class="special">=</span> <span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">;</span></pre>
+ involves the creation of a temporary <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ inside <code class="computeroutput"><span class="keyword">operator</span> <span class="special">+</span></code>
+ because it is not able to write the result directly into <code class="computeroutput"><span class="identifier">x</span></code> which may already have enough memory
+ allocated to hold the result. Instead rewrite it into
+<pre class="programlisting"><span class="identifier">x</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
+<span class="identifier">x</span> <span class="special">+=</span> <span class="identifier">b</span><span class="special">;</span>
+</pre>
+ This trick proves to be useful only for simple operations like addition
+ and subtraction.
+ </li>
+<li>
+ In operations involving built in integral types, try to use unsigned types,
+ preferrably unsigned types that are as large or smaller than mp_int&lt;&gt;::digit_type.
+ </li>
+<li>
+ Use hexadecimal digits for input and output. Conversion from/to power of
+ two bases uses a O(n) algorithm which is not possible for base 10.
+ </li>
+</ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.performance.measurements"></a><a class="link" href="performance.html#mp_int.performance.measurements" title="Measurements">Measurements</a>
+</h3></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_">AMD
+ Athlon XP 2000+</a></span></dt></dl></div>
+<p>
+ A benchmark program is supplied with Boost.Mp_math under libs/mp_math/tools/benchmark.
+ This benchmark compares some primitive operations of different multi precision
+ integer libraries. It creates detailed result files and uses gnuplot
+ to create graphs.
+ </p>
+<p>
+ Example invocations:
+ </p>
+<pre class="programlisting">benchmark // runs all benches
+benchmark --help
+benchmark --ops="add subtract multiply" --libs="boost.mp_math libtommath"
+</pre>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_"></a><a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_" title="AMD Athlon XP 2000+">AMD
+ Athlon XP 2000+</a>
+</h4></div></div></div>
+<pre class="programlisting">Operating System: Arch Linux (i686), Kernel 2.6.26, glibc 2.8
+Compiler: gcc-4.3.2
+</pre>
+<p>
+ Libraries being compared:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ Boost.Mp_math-1_37
+ <div class="itemizedlist"><ul type="circle"><li>
+ switches used: -ftemplate-depth-128 -O3 -finline-functions -march=i686
+ -mtune=generic -std=c++0x
+ </li></ul></div>
+</li>
+<li>
+ libtommath-0.41
+ <div class="itemizedlist"><ul type="circle"><li>
+ switches used: -ftemplate-depth-128 -O3 -finline-functions -march=i686
+ -mtune=generic
+ </li></ul></div>
+</li>
+<li>
+ gmp-4.2.2 (precompiled distribution package, uses generic i386 asm and
+ Intel P6 (Pentium Pro) asm where available)
+ <div class="itemizedlist"><ul type="circle"><li>
+ switches used: -march=i686 -mtune=generic -O2
+ </li></ul></div>
+</li>
+</ul></div>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.input_vectors"></a><h4>
+<a name="id3152872"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.input_vectors">Input
+ vectors</a>
+ </h4>
+<p>
+ Operand size is measured in number of bits. I chose to vary the operand
+ size for the benchmarks a little to see how well the operation handles
+ inputs of differing sizes. Benchmarks that use only one operand use operand
+ 1. <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/input_vecs.png" alt="input_vecs"></span>
+ </p>
+<p>
+ While input operand 1 grows linearly, input operand 2's size is determined
+ by a modified sine function.
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.construct_from_decimal_string"></a><h4>
+<a name="id3152920"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.construct_from_decimal_string">Construct
+ from decimal string</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/ctor_dec.png" alt="ctor_dec"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.construct_from_hex_string"></a><h4>
+<a name="id3152959"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.construct_from_hex_string">Construct
+ from hex string</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/ctor_hex.png" alt="ctor_hex"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.conversion_to_decimal_string"></a><h4>
+<a name="id3152999"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.conversion_to_decimal_string">Conversion
+ to decimal string</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/to_dec.png" alt="to_dec"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.conversion_to_hex_string"></a><h4>
+<a name="id3153038"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.conversion_to_hex_string">Conversion
+ to hex string</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/to_hex.png" alt="to_hex"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.add"></a><h4>
+<a name="id3153077"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.add">Add</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/add.png" alt="add"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.subtract"></a><h4>
+<a name="id3153113"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.subtract">Subtract</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/subtract.png" alt="subtract"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.multiply"></a><h4>
+<a name="id3153150"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.multiply">Multiply</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/multiply.png" alt="multiply"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.divide"></a><h4>
+<a name="id3153186"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.divide">Divide</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/divide.png" alt="divide"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.modulo"></a><h4>
+<a name="id3153223"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.modulo">Modulo</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/modulo.png" alt="modulo"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.square"></a><h4>
+<a name="id3153259"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.square">Square</a>
+ </h4>
+<p>
+ <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/square.png" alt="square"></span>
+ </p>
+<a name="mp_int.performance.measurements.amd_athlon_xp_2000_.modular_power"></a><h4>
+<a name="id3153296"></a>
+ <a class="link" href="performance.html#mp_int.performance.measurements.amd_athlon_xp_2000_.modular_power">Modular
+ Power</a>
+ </h4>
+<p>
+ The operation looks like this: <code class="computeroutput"><span class="identifier">dest</span>
+ <span class="special">=</span> <span class="special">(</span><span class="identifier">op1</span> <span class="special">^</span> <span class="identifier">op1</span><span class="special">)</span> <span class="special">%</span> <span class="identifier">op2</span></code>.
+ This graph uses a logarithmic scale. <span class="inlinemediaobject"><img src="../benchmark_imgs/k7/modpow.png" alt="modpow"></span>
+ </p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="implementation_notes.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/primality_tests_reference.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/primality_tests_reference.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,211 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Primality Tests reference</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="uniform_mp_int_bits_reference.html" title="uniform_mp_int_bits reference">
+<link rel="next" href="bibliography.html" title="Bibliography">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="uniform_mp_int_bits_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bibliography.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.primality_tests_reference"></a><a class="link" href="primality_tests_reference.html" title="Primality Tests reference">Primality Tests reference</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">primality_division_test</span></dt>
+<dt><span class="section">primality_fermat_test</span></dt>
+<dt><span class="section">primality_miller_rabin_test</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.primality_tests_reference.primality_division_test"></a><a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_division_test" title="primality_division_test">primality_division_test</a>
+</h3></div></div></div>
+<p>
+ This function object tests a candidate <code class="computeroutput"><span class="identifier">p</span></code>
+ by repeatedly dividing it by small primes (2, 3, 5, 7, 11...). This is a
+ test that should be used before other more complex tests because it quickly
+ sieves out composite numbers. For example, testing for 2, 5, 7 will eliminate
+ 54% of all numbers, testing for all primes less than 100 eliminates 70%,
+ for all primes less than 256 it is 80%.
+ </p>
+<a name="mp_int.primality_tests_reference.primality_division_test.synopsis"></a><h5>
+<a name="id3099918"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_division_test.synopsis">Synopsis</a>
+ </h5>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">struct</span> <span class="identifier">primality_division_test</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="identifier">result_type</span><span class="special">;</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<a name="mp_int.primality_tests_reference.primality_division_test.members"></a><h4>
+<a name="id3195994"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_division_test.members">Members</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Returns true if <code class="computeroutput"><span class="identifier">p</span></code> is probably prime. Returns false if
+ <code class="computeroutput"><span class="identifier">p</span></code> is definitely composite.
+ </li></ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.primality_tests_reference.primality_fermat_test"></a><a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_fermat_test" title="primality_fermat_test">primality_fermat_test</a>
+</h3></div></div></div>
+<p>
+ This test is based on Fermat's little theorem which states that if an integer
+ <code class="computeroutput"><span class="identifier">p</span></code> is prime, then for all
+ integers <code class="computeroutput"><span class="identifier">a</span></code> where 0 &lt;
+ <code class="computeroutput"><span class="identifier">a</span></code> &lt; <code class="computeroutput"><span class="identifier">p</span></code>
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">a</span><span class="special">**(</span><span class="identifier">p</span><span class="special">-</span><span class="number">1</span><span class="special">)</span> <span class="special">=</span> <span class="number">1</span>
+ <span class="special">(</span><span class="identifier">mod</span>
+ <span class="identifier">p</span><span class="special">)</span></code>
+ </p>
+<p>
+ an alternative formulation is
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">a</span><span class="special">**</span><span class="identifier">p</span> <span class="special">=</span> <span class="identifier">a</span>
+ <span class="special">(</span><span class="identifier">mod</span>
+ <span class="identifier">p</span><span class="special">)</span></code>
+ </p>
+<p>
+ For each round the test creates a random base <code class="computeroutput"><span class="identifier">a</span></code>
+ and checks if the condition holds. There is a class of pseudoprimes called
+ carmichael numbers which are less likely though not impossible with enough
+ rounds to be detected by this test.
+ </p>
+<a name="mp_int.primality_tests_reference.primality_fermat_test.synopsis"></a><h5>
+<a name="id3196375"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_fermat_test.synopsis">Synopsis</a>
+ </h5>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Distribution</span> <span class="special">=</span> <span class="identifier">uniform_mp_int</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">primality_fermat_test</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">Distribution</span> <span class="identifier">distribution_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="identifier">result_type</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">primality_fermat_test</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">rounds</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<a name="mp_int.primality_tests_reference.primality_fermat_test.members"></a><h4>
+<a name="id3196700"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_fermat_test.members">Members</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">primality_fermat_test</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">r</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Constructs a <code class="computeroutput"><span class="identifier">primality_fermat_test</span></code>
+ object with the number of test rounds given by <code class="computeroutput"><span class="identifier">r</span></code>.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Returns true if <code class="computeroutput"><span class="identifier">p</span></code> is probably prime. Returns false if
+ <code class="computeroutput"><span class="identifier">p</span></code> is definitely composite.
+ </li></ul></div>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.primality_tests_reference.primality_miller_rabin_test"></a><a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_miller_rabin_test" title="primality_miller_rabin_test">primality_miller_rabin_test</a>
+</h3></div></div></div>
+<p>
+ This test is an improved version of the Fermat primality test that will also
+ detect carmichael numbers.
+ </p>
+<a name="mp_int.primality_tests_reference.primality_miller_rabin_test.synopsis"></a><h5>
+<a name="id3197010"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_miller_rabin_test.synopsis">Synopsis</a>
+ </h5>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Distribution</span> <span class="special">=</span> <span class="identifier">uniform_mp_int</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">primality_miller_rabin_test</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">Distribution</span> <span class="identifier">distribution_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="identifier">result_type</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">primality_miller_rabin_test</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">r</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">recommended_number_of_rounds</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">bits</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<a name="mp_int.primality_tests_reference.primality_miller_rabin_test.members"></a><h4>
+<a name="id3197388"></a>
+ <a class="link" href="primality_tests_reference.html#mp_int.primality_tests_reference.primality_miller_rabin_test.members">Members</a>
+ </h4>
+<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">primality_miller_rabin_test</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">r</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Constructs a <code class="computeroutput"><span class="identifier">primality_miller_rabin_test</span></code>
+ object with the number of test rounds given by <code class="computeroutput"><span class="identifier">r</span></code>.
+ If <code class="computeroutput"><span class="identifier">r</span> <span class="special">==</span>
+ <span class="number">0</span></code> then each invocation of this function
+ object will use the recommended number of rounds.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Engine</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">p</span></code>
+ is odd.
+ </li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Returns true if <code class="computeroutput"><span class="identifier">p</span></code> is probably prime. Returns false if
+ <code class="computeroutput"><span class="identifier">p</span></code> is definitely composite.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">recommended_number_of_rounds</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">bits</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Returns the recommended number
+ of rounds for a number of precision <code class="computeroutput"><span class="identifier">bits</span></code>
+ so that the probability of error is less than 2^-96.
+ </li></ul></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="uniform_mp_int_bits_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bibliography.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/tutorial.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/tutorial.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,264 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="../index.html" title="Chapter 1. mp_int">
+<link rel="next" href="performance.html" title="Performance">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">General use</span></dt>
+<dt><span class="section"><a href="tutorial.html#mp_int.tutorial.random_number_generation">Random number
+ generation</a></span></dt>
+<dt><span class="section">Primality testing</span></dt>
+<dt><span class="section"><a href="tutorial.html#mp_int.tutorial.prime_number_generation">Prime number
+ generation</a></span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.tutorial.general_use"></a><a class="link" href="tutorial.html#mp_int.tutorial.general_use" title="General use">General use</a>
+</h3></div></div></div>
+<p>
+ The only header you need to include to use the library is <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mp_math</span><span class="special">/</span><span class="identifier">mp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.
+ This is a header-only library so deployment is easy. All functions and objects
+ of this library live in namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mp_math</span></code>.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mp_math</span><span class="special">/</span><span class="identifier">mp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mp_math</span><span class="special">;</span>
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">std</span><span class="special">;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="comment">// init from string
+</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">x</span><span class="special">(</span><span class="string">"93423894782394782347823947289374"</span><span class="special">);</span>
+ <span class="comment">// init from integral type
+</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">y</span> <span class="special">=</span> <span class="number">2340</span><span class="special">;</span>
+ <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">z</span> <span class="special">=</span> <span class="identifier">x</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">;</span>
+
+ <span class="comment">// stream output reacts to stream flags
+</span> <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">hex</span> <span class="special">&lt;&lt;</span> <span class="identifier">z</span> <span class="special">&lt;&lt;</span> <span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="comment">// automatic detection of radix using the base prefix 0x
+</span> <span class="identifier">z</span> <span class="special">=</span> <span class="string">"0xaaaabbbbccccddddeeeeffff222255557777"</span><span class="special">;</span>
+
+ <span class="identifier">z</span> <span class="special">/=</span> <span class="identifier">y</span><span class="special">;</span>
+
+ <span class="comment">// explicit conversion to string according to formatting flags
+</span> <span class="identifier">string</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">z</span><span class="special">.</span><span class="identifier">to_string</span><span class="special">&lt;</span><span class="identifier">string</span><span class="special">&gt;(</span><span class="identifier">ios</span><span class="special">::</span><span class="identifier">hex</span> <span class="special">|</span> <span class="identifier">ios</span><span class="special">::</span><span class="identifier">showbase</span><span class="special">);</span>
+ <span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">s</span> <span class="special">&lt;&lt;</span> <span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">z</span> <span class="special">-=</span> <span class="identifier">z</span><span class="special">;</span>
+
+ <span class="comment">// explicit conversion to built in integral types - this will throw
+</span> <span class="comment">// std::overflow_error if int does not have enough precision to hold the
+</span> <span class="comment">// result
+</span> <span class="keyword">int</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">z</span><span class="special">.</span><span class="identifier">to_integral</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;();</span>
+
+ <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ In most cases the <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ type will behave like a built in integral type.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.tutorial.random_number_generation"></a><a class="link" href="tutorial.html#mp_int.tutorial.random_number_generation" title="Random number generation">Random number
+ generation</a>
+</h3></div></div></div>
+<p>
+ The random number generators have interfaces similar to Boost.Random. Including
+ <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">random</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ is not necessary because it is used internally by the <code class="computeroutput"><span class="identifier">mp_int</span></code>
+ random machinery. The random number engine <code class="computeroutput"><span class="identifier">mt19937</span></code>
+ that we use from here on lives in namespace <code class="computeroutput"><span class="identifier">boost</span></code>.
+ </p>
+<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">min</span><span class="special">(</span><span class="number">0U</span><span class="special">);</span>
+<span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">max</span><span class="special">(</span><span class="string">"0x8974651231456456564"</span><span class="special">);</span>
+
+<span class="identifier">uniform_mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">generator</span><span class="special">(</span><span class="identifier">min</span><span class="special">,</span> <span class="identifier">max</span><span class="special">);</span>
+
+<span class="comment">// Choose a random number engine.
+</span><span class="identifier">mt19937</span> <span class="identifier">e</span><span class="special">;</span>
+
+<span class="comment">// Now generate a random number.
+</span><span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">generator</span><span class="special">(</span><span class="identifier">e</span><span class="special">);</span>
+</pre>
+<p>
+ Another probably more useful alternative is to generate random numbers of
+ a certain precision measured in bits.
+ </p>
+<pre class="programlisting"><span class="comment">// A generator for 2048 bit integers.
+</span><span class="identifier">uniform_mp_int_bits</span><span class="special">&lt;&gt;</span> <span class="identifier">generator</span><span class="special">(</span><span class="number">2048</span><span class="special">);</span>
+
+<span class="identifier">mt19937</span> <span class="identifier">e</span><span class="special">;</span>
+<span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">generator</span><span class="special">(</span><span class="identifier">e</span><span class="special">);</span>
+</pre>
+<p>
+ Note that the numbers will always be 2048 bits large, i.e. the 2048th bit
+ is always set to 1.
+ </p>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.tutorial.primality_testing"></a><a class="link" href="tutorial.html#mp_int.tutorial.primality_testing" title="Primality testing">Primality testing</a>
+</h3></div></div></div>
+<p>
+ Currently all primality tests in this library are probabilistic. A probabilistic
+ primality test cannot ascertain that a prime candidate p is really prime.
+ It can however ascertain that it is a composite number.
+ </p>
+<p>
+ Here we will learn how to test a number <code class="computeroutput"><span class="identifier">p</span></code>
+ for primality using the fermat primality test. We use boost::bind to bind
+ the random number engine to the test functor. That is necessary because the
+ test functor's function invocation operator needs the random number engine.
+ The operator looks like this:
+ </p>
+<pre class="programlisting"><span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<p>
+ We need to bind the random number engine to the first parameter slot. Let's
+ do it!
+ </p>
+<pre class="programlisting"><span class="comment">// Create the fermat test functor with 4 rounds of testing.
+</span><span class="identifier">primality_fermat_test</span><span class="special">&lt;&gt;</span> <span class="identifier">test</span><span class="special">(</span><span class="number">4</span><span class="special">);</span>
+
+<span class="comment">// Create a random number engine.
+</span><span class="identifier">mt19937</span> <span class="identifier">rng</span><span class="special">;</span>
+
+<span class="comment">// Create a random 1024 bit candidate number.
+</span><span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">p</span> <span class="special">=</span> <span class="identifier">uniform_mp_int_bits</span><span class="special">&lt;&gt;(</span><span class="number">1024</span><span class="special">)(</span><span class="identifier">rng</span><span class="special">);</span>
+
+<span class="keyword">bool</span> <span class="identifier">is_p_prime</span> <span class="special">=</span> <span class="identifier">is_prime</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">test</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">));</span>
+</pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mp_int.tutorial.prime_number_generation"></a><a class="link" href="tutorial.html#mp_int.tutorial.prime_number_generation" title="Prime number generation">Prime number
+ generation</a>
+</h3></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">prime_generator</span></dt>
+<dt><span class="section">safe_prime_generator</span></dt>
+</dl></div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="mp_int.tutorial.prime_number_generation.prime_generator"></a><a class="link" href="tutorial.html#mp_int.tutorial.prime_number_generation.prime_generator" title="prime_generator">prime_generator</a>
+</h4></div></div></div>
+<p>
+ First we will look at how to generate prime numbers using a simple trial
+ division test. What this means is that the prime generator creates a random
+ number and then repeatedly divides it by small primes until it finds a
+ number that passes this test.
+ </p>
+<pre class="programlisting"><span class="comment">// Create a generator for 2048 bit primes.
+</span><span class="identifier">prime_generator</span><span class="special">&lt;</span><span class="identifier">primality_division_test</span><span class="special">&gt;</span> <span class="identifier">generator</span><span class="special">(</span><span class="number">2048</span><span class="special">);</span>
+
+<span class="comment">// Create a random number engine.
+</span><span class="identifier">mt19937</span> <span class="identifier">rng</span><span class="special">;</span>
+
+<span class="comment">// Now create a prime.
+</span><span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">prime</span> <span class="special">=</span> <span class="identifier">generator</span><span class="special">(</span><span class="identifier">rng</span><span class="special">);</span>
+</pre>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="mp_int.tutorial.prime_number_generation.safe_prime_generator"></a><a class="link" href="tutorial.html#mp_int.tutorial.prime_number_generation.safe_prime_generator" title="safe_prime_generator">safe_prime_generator</a>
+</h4></div></div></div>
+<p>
+ A safe prime is a prime <code class="computeroutput"><span class="identifier">p</span></code>
+ for which <code class="computeroutput"><span class="special">(</span><span class="identifier">p</span><span class="special">-</span><span class="number">1</span><span class="special">)/</span><span class="number">2</span></code> is also prime. Such prime numbers are much
+ rarer and thus take longer to generate.
+ </p>
+<p>
+ Now we will look at how to use a more sophisticated primality test like
+ <code class="computeroutput"><span class="identifier">primality_miller_rabin_test</span></code>
+ for prime number generation. It is very useful to combine this test with
+ the <code class="computeroutput"><span class="identifier">primality_division_test</span></code>.
+ This will involve a bit of code, mostly because <code class="computeroutput"><span class="identifier">primality_miller_rabin_test</span></code>
+ and <code class="computeroutput"><span class="identifier">safe_prime_generator</span></code>
+ require a random number generator. The latter needs randomness to create
+ a candidate to test for primality and the miller rabin test needs randomness
+ to test the candidate effectively.
+ </p>
+<pre class="programlisting"><span class="comment">// Define a function object that checks a prime candidate p first with a trial
+</span><span class="comment">// division and then with the miller-rabin algorithm. For ease of use we give
+</span><span class="comment">// it default template arguments.
+</span><span class="comment">// It does not hold a reference to the random number engine because that could
+</span><span class="comment">// lead to lifetime problems.
+</span><span class="keyword">template</span><span class="special">&lt;</span>
+ <span class="keyword">class</span> <span class="identifier">Engine</span> <span class="special">=</span> <span class="identifier">mt19937</span><span class="special">,</span>
+ <span class="keyword">class</span> <span class="identifier">Distribution</span> <span class="special">=</span> <span class="identifier">uniform_mp_int_bits</span><span class="special">&lt;&gt;</span>
+<span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">primality_test</span>
+<span class="special">{</span>
+ <span class="identifier">primality_division_test</span> <span class="identifier">test1</span><span class="special">;</span>
+ <span class="identifier">primality_miller_rabin_test</span><span class="special">&lt;</span><span class="identifier">Distribution</span><span class="special">&gt;</span> <span class="identifier">test2</span><span class="special">;</span>
+ <span class="identifier">Engine</span> <span class="identifier">rng</span><span class="special">;</span>
+
+ <span class="keyword">explicit</span> <span class="identifier">tester</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Engine</span><span class="special">&amp;</span> <span class="identifier">e</span> <span class="special">=</span> <span class="identifier">Engine</span><span class="special">())</span> <span class="special">:</span> <span class="identifier">rng</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span> <span class="special">{}</span>
+
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;&amp;</span> <span class="identifier">p</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">test1</span><span class="special">(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">&amp;&amp;</span> <span class="identifier">test2</span><span class="special">(</span><span class="identifier">rng</span><span class="special">,</span> <span class="identifier">p</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="comment">// Create a random number engine that we will feed to the different
+</span><span class="comment">// algorithms.
+</span><span class="identifier">mt19937</span> <span class="identifier">rng</span><span class="special">;</span>
+
+<span class="comment">// Create a generator for safe primes with 128 bits precision.
+</span><span class="keyword">typedef</span> <span class="identifier">safe_prime_generator</span><span class="special">&lt;</span><span class="identifier">primality_test</span><span class="special">&lt;&gt;,</span> <span class="identifier">uniform_mp_int_bits</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span>
+ <span class="identifier">generator_type</span><span class="special">;</span>
+
+<span class="identifier">generator_type</span> <span class="identifier">generator</span><span class="special">(</span><span class="number">128</span><span class="special">,</span> <span class="identifier">primality_test</span><span class="special">&lt;&gt;(</span><span class="identifier">rng</span><span class="special">));</span>
+
+<span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="identifier">prime</span> <span class="special">=</span> <span class="identifier">generator</span><span class="special">(</span><span class="identifier">rng</span><span class="special">);</span>
+</pre>
+<p>
+ Remember, the generated numbers are <span class="emphasis"><em>probably</em></span> prime.
+ </p>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="performance.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_bits_reference.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_bits_reference.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,104 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>uniform_mp_int_bits reference</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="uniform_mp_int_reference.html" title="uniform_mp_int reference">
+<link rel="next" href="primality_tests_reference.html" title="Primality Tests reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="uniform_mp_int_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primality_tests_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.uniform_mp_int_bits_reference"></a><a class="link" href="uniform_mp_int_bits_reference.html" title="uniform_mp_int_bits reference">uniform_mp_int_bits
+ reference</a>
+</h2></div></div></div>
+<a name="mp_int.uniform_mp_int_bits_reference.synopsis"></a><h4>
+<a name="id3194915"></a>
+ <a class="link" href="uniform_mp_int_bits_reference.html#mp_int.uniform_mp_int_bits_reference.synopsis">Synopsis</a>
+ </h4>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">MpInt</span> <span class="special">=</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">uniform_mp_int_bits</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">MpInt</span> <span class="identifier">input_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">MpInt</span> <span class="identifier">result_type</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">has_fixed_range</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">uniform_mp_int_bits</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">MpInt</span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">bits</span><span class="special">);</span>
+
+ <span class="identifier">result_type</span> <span class="identifier">min</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="identifier">result_type</span> <span class="identifier">max</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">reset</span><span class="special">();</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">UniformRandomNumberGenerator</span><span class="special">&gt;</span>
+ <span class="identifier">result_type</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">UniformRandomNumberGenerator</span><span class="special">&amp;</span> <span class="identifier">urng</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<a name="mp_int.uniform_mp_int_bits_reference.members"></a><h4>
+<a name="id3195263"></a>
+ <a class="link" href="uniform_mp_int_bits_reference.html#mp_int.uniform_mp_int_bits_reference.members">Members</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">uniform_mp_int_bits</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">MpInt</span><span class="special">::</span><span class="identifier">size_type</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Constructs a <code class="computeroutput"><span class="identifier">uniform_mp_int_bits</span></code>
+ object. All numbers generated by this object will be <code class="computeroutput"><span class="identifier">x</span></code>
+ bits in size.
+ </li></ul></div>
+<pre class="programlisting"><span class="identifier">result_type</span> <span class="identifier">min</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> The least value of the distribution.
+ </li></ul></div>
+<pre class="programlisting"><span class="identifier">result_type</span> <span class="identifier">max</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> The greatest value of the distribution.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">reset</span><span class="special">();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Resets the state of the distribution
+ function.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">UniformRandomNumberGenerator</span><span class="special">&gt;</span>
+<span class="identifier">result_type</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">UniformRandomNumberGenerator</span><span class="special">&amp;</span> <span class="identifier">urng</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> A uniform random number <code class="computeroutput"><span class="identifier">x</span></code> in the range <code class="computeroutput"><span class="identifier">min</span>
+ <span class="special">&lt;=</span> <span class="identifier">x</span>
+ <span class="special">&lt;=</span> <span class="identifier">max</span></code>.
+ </li></ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="uniform_mp_int_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="primality_tests_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_reference.html
==============================================================================
--- (empty file)
+++ sandbox/mp_math/libs/mp_math/doc/html/mp_int/uniform_mp_int_reference.html 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -0,0 +1,110 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>uniform_mp_int reference</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
+<link rel="home" href="../index.html" title="Chapter 1. mp_int">
+<link rel="up" href="../index.html" title="Chapter 1. mp_int">
+<link rel="prev" href="mp_int_traits_reference.html" title="mp_int_traits reference">
+<link rel="next" href="uniform_mp_int_bits_reference.html" title="uniform_mp_int_bits reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="mp_int_traits_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="uniform_mp_int_bits_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mp_int.uniform_mp_int_reference"></a><a class="link" href="uniform_mp_int_reference.html" title="uniform_mp_int reference">uniform_mp_int reference</a>
+</h2></div></div></div>
+<a name="mp_int.uniform_mp_int_reference.synopsis"></a><h4>
+<a name="id3194095"></a>
+ <a class="link" href="uniform_mp_int_reference.html#mp_int.uniform_mp_int_reference.synopsis">Synopsis</a>
+ </h4>
+<pre class="programlisting"><span class="comment">// &lt;boost/mp_math/mp_int.hpp&gt;
+</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">MpInt</span> <span class="special">=</span> <span class="identifier">mp_int</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">uniform_mp_int</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">MpInt</span> <span class="identifier">input_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">MpInt</span> <span class="identifier">result_type</span><span class="special">;</span>
+
+ <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">has_fixed_range</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">uniform_mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MpInt</span><span class="special">&amp;</span> <span class="identifier">min</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">MpInt</span><span class="special">&amp;</span> <span class="identifier">max</span><span class="special">);</span>
+
+ <span class="identifier">result_type</span> <span class="identifier">min</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="identifier">result_type</span> <span class="identifier">max</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+
+ <span class="keyword">void</span> <span class="identifier">reset</span><span class="special">();</span>
+
+ <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">UniformRandomNumberGenerator</span><span class="special">&gt;</span>
+ <span class="identifier">result_type</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">UniformRandomNumberGenerator</span><span class="special">&amp;</span> <span class="identifier">urng</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<a name="mp_int.uniform_mp_int_reference.members"></a><h4>
+<a name="id3194464"></a>
+ <a class="link" href="uniform_mp_int_reference.html#mp_int.uniform_mp_int_reference.members">Members</a>
+ </h4>
+<pre class="programlisting"><span class="identifier">uniform_mp_int</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MpInt</span><span class="special">&amp;</span> <span class="identifier">min</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">MpInt</span><span class="special">&amp;</span> <span class="identifier">max</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc">
+<li>
+<span class="bold"><strong>Requires: </strong></span><code class="computeroutput"><span class="identifier">min</span>
+ <span class="special">&lt;=</span> <span class="identifier">max</span></code>
+</li>
+<li>
+<span class="bold"><strong>Effects:</strong></span> Constructs a <code class="computeroutput"><span class="identifier">uniform_mp_int</span></code>
+ object. <code class="computeroutput"><span class="identifier">min</span></code> and <code class="computeroutput"><span class="identifier">max</span></code> are the parameters of the distribution.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="identifier">result_type</span> <span class="identifier">min</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> The <code class="computeroutput"><span class="identifier">min</span></code>
+ parameter of the distribution.
+ </li></ul></div>
+<pre class="programlisting"><span class="identifier">result_type</span> <span class="identifier">max</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> The <code class="computeroutput"><span class="identifier">max</span></code>
+ parameter of the distribution.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">reset</span><span class="special">();</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Effects:</strong></span> Resets the state of the distribution
+ function.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">UniformRandomNumberGenerator</span><span class="special">&gt;</span>
+<span class="identifier">result_type</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">UniformRandomNumberGenerator</span><span class="special">&amp;</span> <span class="identifier">urng</span><span class="special">);</span>
+</pre>
+<div class="itemizedlist"><ul type="disc"><li>
+<span class="bold"><strong>Returns:</strong></span> A uniform random number <code class="computeroutput"><span class="identifier">x</span></code> in the range <code class="computeroutput"><span class="identifier">min</span>
+ <span class="special">&lt;=</span> <span class="identifier">x</span>
+ <span class="special">&lt;=</span> <span class="identifier">max</span></code>.
+ </li></ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2008 - 2009 Kevin Sopp<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
+ [source-mode c++
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="mp_int_traits_reference.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="uniform_mp_int_bits_reference.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Modified: sandbox/mp_math/libs/mp_math/doc/mp_int.qbk
==============================================================================
--- sandbox/mp_math/libs/mp_math/doc/mp_int.qbk (original)
+++ sandbox/mp_math/libs/mp_math/doc/mp_int.qbk 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -1,13 +1,13 @@
-[/ Copyright Kevin Sopp 2008.
+[/ Copyright Kevin Sopp 2008 - 2009.
  / 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)]
 
-[library mp_int
+[library mp_int
   [quickbook 1.4]
   [id mp_int]
   [dirname mp_int]
- [copyright 2008 Kevin Sopp]
+ [copyright 2008 - 2009 Kevin Sopp]
   [purpose multi precision integer arithmetic]
   [authors [Sopp, Kevin]]
   [license Distributed under the Boost Software License, Version 1.0.

Modified: sandbox/mp_math/libs/mp_math/doc/mp_int_reference.qbk
==============================================================================
--- sandbox/mp_math/libs/mp_math/doc/mp_int_reference.qbk (original)
+++ sandbox/mp_math/libs/mp_math/doc/mp_int_reference.qbk 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -1,4 +1,4 @@
-[/ Copyright Kevin Sopp 2008.
+[/ Copyright Kevin Sopp 2008 - 2009.
  / 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)]
@@ -17,40 +17,54 @@
>
   struct mp_int
   {
- typedef Allocator allocator_type;
- typedef Traits traits_type;
- typedef typename traits_type::size_type size_type;
+ typedef Allocator allocator_type;
+ typedef Traits traits_type;
+ typedef typename base_allocator_type::size_type size_type;
 
     // ctor/cctor/dtor/assign
     mp_int();
 
+ explicit mp_int(const allocator_type& a);
+
     template<typename IntegralT>
- mp_int(IntegralT x, typename enable_if<is_integral<IntegralT> >::type* dummy = 0);
-
- mp_int(const char* s);
- mp_int(const wchar_t* s);
+ mp_int(IntegralT,
+ const allocator_type& a = allocator_type(),
+ typename enable_if<is_integral<IntegralT> >::type* dummy = 0);
+
+ template<typename charT>
+ mp_int(const charT*, const allocator_type& a = allocator_type());
+
+ template<typename charT>
+ mp_int(const charT*,
+ std::ios_base::fmtflags,
+ const allocator_type& a = allocator_type());
 
     template<typename charT, class traits, class Alloc>
- mp_int(const std::basic_string<charT,traits,Alloc>& s);
-
- template<typename RandomAccessIterator>
- mp_int(RandomAccessIterator first, RandomAccessIterator last);
-
- mp_int(const char* s, std::ios_base::fmtflags f);
- mp_int(const wchar_t* s, std::ios_base::fmtflags f);
+ mp_int(const std::basic_string<charT,traits,Alloc>&,
+ const allocator_type& a = allocator_type());
 
     template<typename charT, class traits, class Alloc>
- mp_int(const std::basic_string<charT,traits,Alloc>& s, std::ios_base::fmtflags f);
-
+ mp_int(const std::basic_string<charT,traits,Alloc>&,
+ std::ios_base::fmtflags,
+ const allocator_type& a = allocator_type());
+
+ template<typename RandomAccessIterator>
+ mp_int(RandomAccessIterator first,
+ RandomAccessIterator last,
+ const allocator_type& a = allocator_type());
+
     template<typename RandomAccessIterator>
- mp_int(RandomAccessIterator first, RandomAccessIterator last, std::ios_base::fmtflags f);
+ mp_int(RandomAccessIterator first,
+ RandomAccessIterator last,
+ std::ios_base::fmtflags f,
+ const allocator_type& a = allocator_type());
 
     mp_int(const mp_int& copy);
 
     #ifdef BOOST_HAS_RVALUE_REFS
     mp_int(mp_int&& copy);
     #endif
-
+
     ~mp_int();
 
     mp_int& operator = (const mp_int& rhs);
@@ -58,26 +72,26 @@
     #ifdef BOOST_HAS_RVALUE_REFS
     mp_int& operator = (mp_int&& rhs);
     #endif
-
+
     template<typename IntegralT>
     mp_int& operator = (IntegralT rhs);
 
- mp_int& operator = (const char* s);
-
- mp_int& operator = (const wchar_t* s);
+ template<typename charT>
+ mp_int& operator = (const charT*);
 
     template<typename charT, class traits, class Alloc>
- mp_int& operator = (const std::basic_string<charT,traits,Alloc>& s);
+ mp_int& operator = (const std::basic_string<charT,traits,Alloc>&);
 
- void assign(const char* s, std::ios_base::fmtflags f);
-
- void assign(const wchar_t* s, std::ios_base::fmtflags f);
+ template<typename charT>
+ void assign(const charT*, std::ios_base::fmtflags);
 
     template<typename charT, class traits, class Alloc>
- void assign(const std::basic_string<charT,traits,Alloc>& s, std::ios_base::fmtflags f);
-
+ void assign(const std::basic_string<charT,traits,Alloc>&,
+ std::ios_base::fmtflags);
+
     template<typename RandomAccessIterator>
- void assign(RandomAccessIterator first, RandomAccessIterator last, std::ios_base::fmtflags f);
+ void assign(RandomAccessIterator first, RandomAccessIterator last,
+ std::ios_base::fmtflags);
 
     // modifiers
     #ifdef BOOST_HAS_RVALUE_REFS
@@ -121,25 +135,15 @@
     template<typename IntegralT> mp_int& operator &= (IntegralT x);
     template<typename IntegralT> mp_int& operator ^= (IntegralT x);
 
- // operators involving char strings
- mp_int& operator += (const char* s);
- mp_int& operator -= (const char* s);
- mp_int& operator *= (const char* s);
- mp_int& operator /= (const char* s);
- mp_int& operator %= (const char* s);
- mp_int& operator |= (const char* s);
- mp_int& operator &= (const char* s);
- mp_int& operator ^= (const char* s);
-
- // operators involving wchar_t strings
- mp_int& operator += (const wchar_t* s);
- mp_int& operator -= (const wchar_t* s);
- mp_int& operator *= (const wchar_t* s);
- mp_int& operator /= (const wchar_t* s);
- mp_int& operator %= (const wchar_t* s);
- mp_int& operator |= (const wchar_t* s);
- mp_int& operator &= (const wchar_t* s);
- mp_int& operator ^= (const wchar_t* s);
+ // operators involving character strings
+ template<typename charT> mp_int& operator += (const charT*);
+ template<typename charT> mp_int& operator -= (const charT*);
+ template<typename charT> mp_int& operator *= (const charT*);
+ template<typename charT> mp_int& operator /= (const charT*);
+ template<typename charT> mp_int& operator %= (const charT*);
+ template<typename charT> mp_int& operator |= (const charT*);
+ template<typename charT> mp_int& operator &= (const charT*);
+ template<typename charT> mp_int& operator ^= (const charT*);
 
     // operators involving std::basic_string
     template<typename charT, class traits, class Alloc>
@@ -181,11 +185,9 @@
     typedef traits_type::digit_type digit_type;
     typedef traits_type::word_type word_type;
 
- bool is_zero() const;
-
     digit_type& operator[](size_type i);
     const digit_type& operator[](size_type i) const;
-
+
     digit_type& at(size_type i);
     const digit_type& at(size_type i) const;
   };
@@ -318,85 +320,45 @@
   template<class A, class T, class charT, class Traits, class Alloc>
   bool operator >= (const std::basic_string<charT,Traits,Alloc>&, const mp_int<A,T>&);
 
- // Comparison between mp_int and const char*
-
- template<class A, class T>
- bool operator == (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator != (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator < (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator > (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator <= (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator >= (const mp_int<A,T>&, const char*);
-
- // Comparison between const char* and mp_int
-
- template<class A, class T>
- bool operator == (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator != (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator < (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator > (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator <= (const char*, const mp_int<A,T>&);
+ // Comparison between mp_int and const charT*
 
   template<class A, class T>
- bool operator >= (const char*, const mp_int<A,T>&);
-
- // Comparison between mp_int and const wchar_t*
+ bool operator == (const mp_int<A,T>&, const charT*);
 
   template<class A, class T>
- bool operator == (const mp_int<A,T>&, const wchar_t*);
+ bool operator != (const mp_int<A,T>&, const charT*);
 
   template<class A, class T>
- bool operator != (const mp_int<A,T>&, const wchar_t*);
+ bool operator < (const mp_int<A,T>&, const charT*);
 
   template<class A, class T>
- bool operator < (const mp_int<A,T>&, const wchar_t*);
+ bool operator > (const mp_int<A,T>&, const charT*);
 
   template<class A, class T>
- bool operator > (const mp_int<A,T>&, const wchar_t*);
+ bool operator <= (const mp_int<A,T>&, const charT*);
 
   template<class A, class T>
- bool operator <= (const mp_int<A,T>&, const wchar_t*);
+ bool operator >= (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator >= (const mp_int<A,T>&, const wchar_t*);
-
- // Comparison between const wchar_t* and mp_int
+ // Comparison between const charT* and mp_int
 
   template<class A, class T>
- bool operator == (const wchar_t*, const mp_int<A,T>&);
+ bool operator == (const charT*, const mp_int<A,T>&);
 
   template<class A, class T>
- bool operator != (const wchar_t*, const mp_int<A,T>&);
+ bool operator != (const charT*, const mp_int<A,T>&);
 
   template<class A, class T>
- bool operator < (const wchar_t*, const mp_int<A,T>&);
+ bool operator < (const charT*, const mp_int<A,T>&);
 
   template<class A, class T>
- bool operator > (const wchar_t*, const mp_int<A,T>&);
+ bool operator > (const charT*, const mp_int<A,T>&);
 
   template<class A, class T>
- bool operator <= (const wchar_t*, const mp_int<A,T>&);
+ bool operator <= (const charT*, const mp_int<A,T>&);
 
   template<class A, class T>
- bool operator >= (const wchar_t*, const mp_int<A,T>&);
+ bool operator >= (const charT*, const mp_int<A,T>&);
 
   // Comparison between mp_int and integral type
 
@@ -468,6 +430,9 @@
   mp_int<A,T> pow(const mp_int<A,T>& x, typename mp_int<A,T>::digit_type n);
 
   template<class A, class T>
+ mp_int<A,T> pow(const mp_int<A,T>& x, const mp_int<A,T>& n);
+
+ template<class A, class T>
   mp_int<A,T> modpow(const mp_int<A,T>& base, const mp_int<A,T>& exp, const mp_int<A,T>& mod);
 
   template<class A, class T>
@@ -476,6 +441,9 @@
   template<class A, class T>
   mp_int<A,T> nth_root(const mp_int<A,T>& x, typename mp_int<A,T>::digit_type n);
 
+ template<class A, class T>
+ mp_int<A,T> nth_root(const mp_int<A,T>& x, const mp_int<A,T>& n);
+
 
   } // namespace mp_math
   } // namespace boost
@@ -509,8 +477,18 @@
 * [*Throws:] Nothing.
 
 
+ explicit mp_int(const allocator_type& a);
+
+* [*Effects:] Constructs an empty `mp_int` object and initializes its allocator
+with `a`, such an uninitialized `mp_int` has no value, i.e. it is /not/ zero.
+* [*Complexity:] O(1).
+* [*Throws:] Nothing.
+
+
   template<typename IntegralT>
- mp_int(IntegralT x, typename enable_if<boost::is_integral<IntegralT> >::type* dummy = 0);
+ mp_int(IntegralT x,
+ const allocator_type& a = allocator_type(),
+ typename enable_if<is_integral<IntegralT> >::type* dummy = 0);
 
 * [*Effects:] Constructs an `mp_int` object from an integral type. The value of
 the object is that of the integral type.
@@ -518,8 +496,8 @@
 * [*Throws: ] `std::bad_alloc`.
 
 
- mp_int(const char* s);
- mp_int(const wchar_t* s);
+ template<typename charT>
+ mp_int(const charT* s, const allocator_type& a = allocator_type());
 
 * [*Requires: ] `s` points to a valid number formatted as string or to an empty
 string.
@@ -529,31 +507,38 @@
   * `std::invalid_argument` if the string contains an invalid character.
 
 
- template<typename charT, class traits, class Alloc>
- mp_int(const std::basic_string<charT,traits,Alloc>& s);
+ template<typename charT>
+ mp_int(const charT* s,
+ std::ios_base::fmtflags f,
+ const allocator_type& a = allocator_type());
 
-* [*Requires: ] `s` contains a valid number formatted as string or `s` is an
-empty string.
+* [*Requires: ] `s` points to a valid number formatted according to the flags in
+`f` or `s` is an empty string.
 * [*Effects:] Constructs an `mp_int` object from a string.
 * [*Throws:]
   * `std::bad_alloc`
- * `std::invalid_argument` if the string contains an invalid character.
+ * `std::invalid_argument` if the string contains an invalid character or if an
+ unrecognized formatting flag was set.
 
 
- template<typename RandomAccessIterator>
- mp_int(RandomAccessIterator first, RandomAccessIterator last);
+ template<typename charT, class traits, class Alloc>
+ mp_int(const std::basic_string<charT,traits,Alloc>& s,
+ const allocator_type& a = allocator_type());
 
-* [*Requires: ] `first` and `last` are iterators into a string.
-* [*Effects:] Constructs an `mp_int` object from two iterators.
+* [*Requires: ] `s` contains a valid number formatted as string or `s` is an
+empty string.
+* [*Effects:] Constructs an `mp_int` object from a string.
 * [*Throws:]
   * `std::bad_alloc`
   * `std::invalid_argument` if the string contains an invalid character.
 
 
- mp_int(const char* s, std::ios_base::fmtflags f);
- mp_int(const wchar_t* s, std::ios_base::fmtflags f);
+ template<typename charT, class traits, class Alloc>
+ mp_int(const std::basic_string<charT,traits,Alloc>& s,
+ std::ios_base::fmtflags f,
+ const allocator_type& a = allocator_type());
 
-* [*Requires: ] `s` points to a valid number formatted according to the flags in
+* [*Requires: ] `s` contains a valid number formatted according to the flags in
 `f` or `s` is an empty string.
 * [*Effects:] Constructs an `mp_int` object from a string.
 * [*Throws:]
@@ -562,20 +547,23 @@
     unrecognized formatting flag was set.
 
 
- template<typename charT, class traits, class Alloc>
- mp_int(const std::basic_string<charT,traits,Alloc>& s, std::ios_base::fmtflags f);
+ template<typename RandomAccessIterator>
+ mp_int(RandomAccessIterator first,
+ RandomAccessIterator last,
+ const allocator_type& a = allocator_type());
 
-* [*Requires: ] `s` contains a valid number formatted according to the flags in
-`f` or `s` is an empty string.
-* [*Effects:] Constructs an `mp_int` object from a string.
+* [*Requires: ] `first` and `last` are iterators into a string.
+* [*Effects:] Constructs an `mp_int` object from two iterators.
 * [*Throws:]
   * `std::bad_alloc`
- * `std::invalid_argument` if the string contains an invalid character or if an
- unrecognized formatting flag was set.
+ * `std::invalid_argument` if the string contains an invalid character.
 
 
   template<typename RandomAccessIterator>
- mp_int(RandomAccessIterator first, RandomAccessIterator last, std::ios_base::fmtflags f);
+ mp_int(RandomAccessIterator first,
+ RandomAccessIterator last,
+ std::ios_base::fmtflags f,
+ const allocator_type& a = allocator_type());
 
 * [*Requires: ] `first` and `last` are iterators into a string formatted
 according to the formatting flags in `f`.
@@ -592,13 +580,13 @@
 * [*Complexity:] O(N), where N is the number of digits in `copy`.
 * [*Throws: ] `std::bad_alloc`.
 
-
+
   mp_int(mp_int&& copy);
 
 * [*Effects:] Constructs an `mp_int` by moving `copy` into `*this`.
 * [*Complexity:] O(1).
 * [*Throws:] Nothing.
-
+
 
   ~mp_int();
 
@@ -615,7 +603,7 @@
 * [*Throws: ] `std::bad_alloc`.
 * [*Exception safety:] strong.
 
-
+
   mp_int& operator = (mp_int&& rhs);
 
 * [*Effects: ] `*this` obtains the value of `rhs`.
@@ -632,8 +620,9 @@
 * [*Throws: ] `std::bad_alloc`.
 * [*Exception safety:] basic.
 
- mp_int& operator = (const char* s);
- mp_int& operator = (const wchar_t* s);
+
+ template<typename charT>
+ mp_int& operator = (const charT* s);
 
 * [*Requires: ] `s` points to a valid number formatted as string or to an empty
 string.
@@ -656,8 +645,8 @@
 * [*Exception safety:] basic.
 
 
- void assign(const char* s, std::ios_base::fmtflags f);
- void assign(const wchar_t* s, std::ios_base::fmtflags f);
+ template<typename charT>
+ void assign(const charT* s, std::ios_base::fmtflags);
 
 * [*Requires: ] `s` points to a valid number formatted according to the flags in
 `f` or `s` is an empty string.
@@ -670,7 +659,7 @@
 
 
   template<typename charT, class traits, class Alloc>
- void assign(const std::basic_string<charT,traits,Alloc>& s, std::ios_base::fmtflags f);
+ void assign(const std::basic_string<charT,traits,Alloc>& s, std::ios_base::fmtflags f);
 
 * [*Requires: ] `s` contains a valid number formatted according to the flags in
 `f` or `s` is an empty string.
@@ -837,7 +826,7 @@
 
  mp_int& operator /= (const mp_int& x);
 
-* [*Requires: ] `x != 0`.
+* [*Requires: ] `x != 0`.
 * [*Effects:] Divides `*this` by `x`.
 * [*Returns: ] `*this`.
 * [*Throws: ]
@@ -849,7 +838,7 @@
 
  mp_int& operator %= (const mp_int& x);
 
-* [*Requires: ] `x != 0`.
+* [*Requires: ] `x != 0`.
 * [*Effects:] Modulus `*this` by `x`.
 * [*Returns: ] `*this`.
 * [*Throws: ]
@@ -954,24 +943,16 @@
 * [*Exception safety:] strong.
 
 
-[heading Operators involving char/wchar_t strings]
+[heading Operators involving charT strings]
 
- mp_int& operator += (const char* s);
- mp_int& operator += (const wchar_t* s);
- mp_int& operator -= (const char* s);
- mp_int& operator -= (const wchar_t* s);
- mp_int& operator *= (const char* s);
- mp_int& operator *= (const wchar_t* s);
- mp_int& operator /= (const char* s);
- mp_int& operator /= (const wchar_t* s);
- mp_int& operator %= (const char* s);
- mp_int& operator %= (const wchar_t* s);
- mp_int& operator |= (const char* s);
- mp_int& operator |= (const wchar_t* s);
- mp_int& operator &= (const char* s);
- mp_int& operator &= (const wchar_t* s);
- mp_int& operator ^= (const char* s);
- mp_int& operator ^= (const wchar_t* s);
+ template<typename charT> mp_int& operator += (const charT* s);
+ template<typename charT> mp_int& operator -= (const charT* s);
+ template<typename charT> mp_int& operator *= (const charT* s);
+ template<typename charT> mp_int& operator /= (const charT* s);
+ template<typename charT> mp_int& operator %= (const charT* s);
+ template<typename charT> mp_int& operator |= (const charT* s);
+ template<typename charT> mp_int& operator &= (const charT* s);
+ template<typename charT> mp_int& operator ^= (const charT* s);
 
 [heading Operators involving std::basic_string]
 
@@ -1207,73 +1188,23 @@
   * `std::invalid_argument` if the string contains an invalid character.
 
 
- template<class A, class T>
- bool operator == (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator != (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator < (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator > (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator <= (const mp_int<A,T>&, const char*);
-
- template<class A, class T>
- bool operator >= (const mp_int<A,T>&, const char*);
-
-* [*Effects:] Converts the string argument to an `mp_int` object and compares it
-to the object on the left side of the expression.
-* [*Throws:]
- * `std::bad_alloc`
- * `std::invalid_argument` if the string contains an invalid character.
-
-
- template<class A, class T>
- bool operator == (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator != (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator < (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator > (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator <= (const char*, const mp_int<A,T>&);
-
- template<class A, class T>
- bool operator >= (const char*, const mp_int<A,T>&);
-
-* [*Effects:] Converts the string argument to an `mp_int` object and compares it
-to the object on the right side of the expression.
-* [*Throws:]
- * `std::bad_alloc`
- * `std::invalid_argument` if the string contains an invalid character.
-
-
- template<class A, class T>
- bool operator == (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator == (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator != (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator != (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator < (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator < (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator > (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator > (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator <= (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator <= (const mp_int<A,T>&, const charT*);
 
- template<class A, class T>
- bool operator >= (const mp_int<A,T>&, const wchar_t*);
+ template<class A, class T, typename charT>
+ bool operator >= (const mp_int<A,T>&, const charT*);
 
 * [*Effects:] Converts the string argument to an `mp_int` object and compares it
 to the object on the left side of the expression.
@@ -1282,23 +1213,23 @@
   * `std::invalid_argument` if the string contains an invalid character.
 
 
- template<class A, class T>
- bool operator == (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator == (const charT*, const mp_int<A,T>&);
 
- template<class A, class T>
- bool operator != (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator != (const charT*, const mp_int<A,T>&);
 
- template<class A, class T>
- bool operator < (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator < (const charT*, const mp_int<A,T>&);
 
- template<class A, class T>
- bool operator > (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator > (const charT*, const mp_int<A,T>&);
 
- template<class A, class T>
- bool operator <= (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator <= (const charT*, const mp_int<A,T>&);
 
- template<class A, class T>
- bool operator >= (const wchar_t*, const mp_int<A,T>&);
+ template<class A, class T, typename charT>
+ bool operator >= (const charT*, const mp_int<A,T>&);
 
 * [*Effects:] Converts the string argument to an `mp_int` object and compares it
 to the object on the right side of the expression.
@@ -1402,6 +1333,9 @@
   template<class A, class T>
   mp_int<A,T> pow(const mp_int<A,T>& x, typename mp_int<A,T>::digit_type n);
 
+ template<class A, class T>
+ mp_int<A,T> pow(const mp_int<A,T>& x, const mp_int<A,T>& n);
+
 * [*Returns:] The `n`th power of `x`.
 * [*Throws: ] `std::bad_alloc`.
 
@@ -1428,6 +1362,9 @@
   template<class A, class T>
   mp_int<A,T> nth_root(const mp_int<A,T>& x, typename mp_int<A,T>::digit_type n);
 
+ template<class A, class T>
+ mp_int<A,T> nth_root(const mp_int<A,T>& x, const mp_int<A,T>& n);
+
 * [*Returns:] The `n`th root of `x`.
 * [*Complexity:] O(log(N)).
 * [*Throws:]

Modified: sandbox/mp_math/libs/mp_math/doc/primality_tests_reference.qbk
==============================================================================
--- sandbox/mp_math/libs/mp_math/doc/primality_tests_reference.qbk (original)
+++ sandbox/mp_math/libs/mp_math/doc/primality_tests_reference.qbk 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -1,4 +1,4 @@
-[/ Copyright Kevin Sopp 2008.
+[/ Copyright Kevin Sopp 2008 - 2009.
  / 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)]
@@ -118,7 +118,7 @@
   template<class Engine, class A, class T>
   bool operator()(Engine& e, const mp_int<A,T>& p) const;
 
-* [*Requires:] `p` is odd.
+* [*Requires: ] `p` is odd.
 * [*Effects:] Returns true if `p` is probably prime. Returns false if `p`
 is definitely composite.
 

Modified: sandbox/mp_math/libs/mp_math/test/integral_ops.cpp
==============================================================================
--- sandbox/mp_math/libs/mp_math/test/integral_ops.cpp (original)
+++ sandbox/mp_math/libs/mp_math/test/integral_ops.cpp 2009-01-16 18:53:21 EST (Fri, 16 Jan 2009)
@@ -146,6 +146,13 @@
   BOOST_CHECK_EQUAL(z, "123495198423");
 }
 
+BOOST_AUTO_TEST_CASE_TEMPLATE(subtract_signed_integral4, mp_int_type, mp_int_types)
+{
+ const mp_int_type x("1");
+ const mp_int_type z = x - 2;
+ BOOST_CHECK_EQUAL(z, "-1");
+}
+
 BOOST_AUTO_TEST_CASE_TEMPLATE(subtract_unsigned_char1, mp_int_type, mp_int_types)
 {
   const unsigned char y = 14;


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