$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r76130 - in sandbox/big_number: boost/multiprecision libs/multiprecision/doc libs/multiprecision/doc/html libs/multiprecision/doc/html/boost_multiprecision libs/multiprecision/doc/html/boost_multiprecision/map libs/multiprecision/doc/html/boost_multiprecision/ref libs/multiprecision/doc/html/boost_multiprecision/tut libs/multiprecision/example libs/multiprecision/test
From: john_at_[hidden]
Date: 2011-12-24 08:13:18
Author: johnmaddock
Date: 2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
New Revision: 76130
URL: http://svn.boost.org/trac/boost/changeset/76130
Log:
Add numerator/denominator accessor functions to rational_adapter.hpp.
Define predefined rational number type for libtommath.
Add rational number specific tests to test_arithmetic.cpp.
Document rational_adapter and related stuff, regenerate docs.
Added:
   sandbox/big_number/libs/multiprecision/example/tommath_snips.cpp   (contents, props changed)
Text files modified: 
   sandbox/big_number/boost/multiprecision/rational_adapter.hpp                              |    10 +                                       
   sandbox/big_number/boost/multiprecision/tommath.hpp                                       |     5                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html           |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html             |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html        |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html        |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html             |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html   |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html             |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html        |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html    |   203 +++++++++++++++++++++++++++++++++++++++ 
   sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html       |     2                                         
   sandbox/big_number/libs/multiprecision/doc/html/index.html                                |     4                                         
   sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk                             |    59 +++++++++++                             
   sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp                           |    12 ++                                      
   sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp                          |     2                                         
   17 files changed, 286 insertions(+), 29 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/rational_adapter.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/rational_adapter.hpp	(original)
+++ sandbox/big_number/boost/multiprecision/rational_adapter.hpp	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -156,6 +156,16 @@
    return get_sign(val.data().numerator().backend());
 }
 
+template <class IntBackend>
+inline mp_number<IntBackend> numerator(const mp_number<rational_adapter<IntBackend> >& val)
+{
+   return val.backend().data().numerator();
+}
+template <class IntBackend>
+inline mp_number<IntBackend> denominator(const mp_number<rational_adapter<IntBackend> >& val)
+{
+   return val.backend().data().denominator();
+}
 
 template<class IntBackend>
 struct number_category<rational_adapter<IntBackend> > : public mpl::int_<number_kind_rational>{};
Modified: sandbox/big_number/boost/multiprecision/tommath.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/tommath.hpp	(original)
+++ sandbox/big_number/boost/multiprecision/tommath.hpp	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -7,6 +7,7 @@
 #define BOOST_MATH_MP_TOMMATH_BACKEND_HPP
 
 #include <boost/multiprecision/mp_number.hpp>
+#include <boost/multiprecision/rational_adapter.hpp>
 #include <boost/math/special_functions/fpclassify.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/lexical_cast.hpp>
@@ -431,7 +432,9 @@
 template<>
 struct number_category<tommath_int> : public mpl::int_<number_kind_integer>{};
 
-typedef mp_number<tommath_int >         mp_int;
+typedef mp_number<tommath_int >                     mp_int;
+typedef rational_adapter<tommath_int>               tommath_rational;
+typedef mp_number<tommath_rational>                 mp_rational;
 
 }}  // namespaces
 
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="tut.html" title="Tutorial">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tut.html"><img src="../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="map/hist.html" title="History">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="ref/backendconc.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="map/hist.html"><img src="../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="todo.html" title="TODO">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="../map.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../map.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="todo.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -9,8 +9,6 @@
 <link rel="prev" href="hist.html" title="History">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="hist.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../map.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="ref/mp_number.html" title="mp_number">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="tut/rational.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="ref/mp_number.html"><img src="../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="../map.html" title="Roadmap">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="mp_number.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../map.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/ref/mp_number.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="backendconc.html" title="Backend Requirements">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="../ref.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="backendconc.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="tut/ints.html" title="Integer Types">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="intro.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tut/ints.html"><img src="../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/ints.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="reals.html" title="Real Numbers">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="../tut.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="reals.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="../ref.html" title="Reference">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="reals.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../ref.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
@@ -63,7 +61,8 @@
                 </p>
               </th>
 </tr></thead>
-<tbody><tr>
+<tbody>
+<tr>
 <td>
                 <p>
                   <code class="computeroutput"><span class="identifier">gmp_rational</span></code>
@@ -94,7 +93,107 @@
                   Dependency on GNU licenced GMP library.
                 </p>
               </td>
-</tr></tbody>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">tommath_rational</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  boost/multiprecision/tommath.hpp
+                </p>
+              </td>
+<td>
+                <p>
+                  2
+                </p>
+              </td>
+<td>
+                <p>
+                  libtommath
+                </p>
+              </td>
+<td>
+                <p>
+                  All C/C++ implementation that's Boost Software Licence compatible.
+                </p>
+              </td>
+<td>
+                <p>
+                  Slower than GMP.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">rational_adapter</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  boost/multiprecision/rational_adapter.hpp
+                </p>
+              </td>
+<td>
+                <p>
+                  N/A
+                </p>
+              </td>
+<td>
+                <p>
+                  none
+                </p>
+              </td>
+<td>
+                <p>
+                  All C++ adapter that allows any inetger backend type to be used
+                  as a rational type.
+                </p>
+              </td>
+<td>
+                <p>
+                  Requires an underlying integer backend type.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  boost/rational.hpp
+                </p>
+              </td>
+<td>
+                <p>
+                  N/A
+                </p>
+              </td>
+<td>
+                <p>
+                  None
+                </p>
+              </td>
+<td>
+                <p>
+                  A C++ rational number type that can used with any <code class="computeroutput"><span class="identifier">mp_number</span></code> integer type.
+                </p>
+              </td>
+<td>
+                <p>
+                  The expression templates used by <code class="computeroutput"><span class="identifier">mp_number</span></code>
+                  end up being "hidden" inside <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span></code>:
+                  performance may well suffer as a result.
+                </p>
+              </td>
+</tr>
+</tbody>
 </table></div>
 <h5>
 <a name="boost_multiprecision.tut.rational.h0"></a>
@@ -171,6 +270,102 @@
 </pre>
 <p>
       </p>
+<h5>
+<a name="boost_multiprecision.tut.rational.h2"></a>
+        <span><a name="boost_multiprecision.tut.rational.tommath_rational"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.tommath_rational">tommath_rational</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
+
+<span class="keyword">typedef</span> <span class="identifier">rational_adpater</span><span class="special"><</span><span class="identifier">tommath_int</span><span class="special">></span>        <span class="identifier">tommath_rational</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">tommath_rational</span> <span class="special">></span>         <span class="identifier">mp_rational</span><span class="special">;</span>
+
+<span class="special">}}</span> <span class="comment">// namespaces</span>
+</pre>
+<p>
+        The <code class="computeroutput"><span class="identifier">tommath_rational</span></code> backend
+        is used via the typedef <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">mp_rational</span></code>.
+        It acts as a thin wrapper around <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span><span class="special"><</span><span class="identifier">mp_int</span><span class="special">></span></code> to provide a rational number type that
+        is a drop-in replacement for the native C++ number types, but with unlimited
+        precision.
+      </p>
+<p>
+        The advantage of using this type rather than <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span><span class="special"><</span><span class="identifier">mp_int</span><span class="special">></span></code> directly, is that it is expression-template
+        enabled, greatly reducing the number of temporaries created in complex expressions.
+      </p>
+<p>
+        There are also non-member functions:
+      </p>
+<pre class="programlisting"><span class="identifier">mp_int</span> <span class="identifier">numerator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_rational</span><span class="special">&);</span>
+<span class="identifier">mp_int</span> <span class="identifier">denominator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mp_rational</span><span class="special">&);</span>
+</pre>
+<p>
+        which return the numerator and denominator of the number.
+      </p>
+<h6>
+<a name="boost_multiprecision.tut.rational.h3"></a>
+        <span><a name="boost_multiprecision.tut.rational.example0"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.example0">Example:</a>
+      </h6>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">tommath</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span>
+
+<span class="identifier">mp_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+
+<span class="comment">// Do some arithmetic:</span>
+<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
+   <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span>
+<span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+</pre>
+<p>
+      </p>
+<h5>
+<a name="boost_multiprecision.tut.rational.h4"></a>
+        <span><a name="boost_multiprecision.tut.rational.use_with_boost_rational"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.use_with_boost_rational">Use With
+        Boost.Rational</a>
+      </h5>
+<p>
+        All of the inetger types in this library can be used as template arguments
+        to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">rational</span><span class="special"><</span><span class="identifier">IntType</span><span class="special">></span></code>.
+      </p>
+<p>
+        Note that using the library in this way largely negates the effect of the
+        expression templates in <code class="computeroutput"><span class="identifier">mp_number</span></code>.
+      </p>
+<h5>
+<a name="boost_multiprecision.tut.rational.h5"></a>
+        <span><a name="boost_multiprecision.tut.rational.rational_adapter"></a></span><a class="link" href="rational.html#boost_multiprecision.tut.rational.rational_adapter">rational_adapter</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">multiprecision</span><span class="special">{</span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">IntBackend</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">rational_adpater</span><span class="special">;</span>
+
+<span class="special">}}</span>
+</pre>
+<p>
+        The class template <code class="computeroutput"><span class="identifier">rational_adapter</span></code>
+        is a backend for <code class="computeroutput"><span class="identifier">mp_number</span></code>
+        which converts any existing integer backend into a rational-number backend.
+      </p>
+<p>
+        So for example, given an integer backend type <code class="computeroutput"><span class="identifier">MyIntegerBackend</span></code>,
+        the use would be something like:
+      </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">MyIntegerBackend</span><span class="special">></span>                    <span class="identifier">MyInt</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">mp_number</span><span class="special"><</span><span class="identifier">rational_adapter</span><span class="special"><</span><span class="identifier">MyIntegerBackend</span><span class="special">></span> <span class="special">></span> <span class="identifier">MyRational</span><span class="special">;</span>
+
+<span class="identifier">MyRational</span> <span class="identifier">r</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+<span class="identifier">r</span> <span class="special">/=</span> <span class="number">3</span><span class="special">;</span>
+<span class="identifier">MyInt</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span>
+<span class="identifier">assert</span><span class="special">(</span><span class="identifier">i</span> <span class="special">==</span> <span class="number">2</span><span class="special">);</span>
+</pre>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 <td align="left"></td>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/reals.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -10,8 +10,6 @@
 <link rel="next" href="rational.html" title="Rational Number Types">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav">
 <a accesskey="p" href="ints.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tut.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="rational.html"><img src="../../images/next.png" alt="Next"></a>
 </div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html	(original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -8,8 +8,6 @@
 <link rel="next" href="boost_multiprecision/intro.html" title="Introduction">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
-<hr>
 <div class="spirit-nav"><a accesskey="n" href="boost_multiprecision/intro.html"><img src="images/next.png" alt="Next"></a></div>
 <div class="chapter">
 <div class="titlepage"><div>
@@ -50,7 +48,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: December 22, 2011 at 11:51:46 GMT</small></p></td>
+<td align="left"><p><small>Last revised: December 24, 2011 at 13:09:42 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>
Modified: sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk	(original)
+++ sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -384,6 +384,9 @@
 [table
 [[Backend Type][Header][Radix][Dependencies][Pros][Cons]]
 [[`gmp_rational`][boost/multiprecision/gmp.hpp][2][GMP][Very fast and efficient backend.][Dependency on GNU licenced GMP library.]]
+[[`tommath_rational`][boost/multiprecision/tommath.hpp][2][libtommath][All C/C++ implementation that's Boost Software Licence compatible.][Slower than GMP.]]
+[[`rational_adapter`][boost/multiprecision/rational_adapter.hpp][N/A][none][All C++ adapter that allows any inetger backend type to be used as a rational type.][Requires an underlying integer backend type.]]
+[[`boost::rational`][boost/rational.hpp][N/A][None][A C++ rational number type that can used with any `mp_number` integer type.][The expression templates used by `mp_number` end up being "hidden" inside `boost::rational`: performance may well suffer as a result.]]
 ]
 
 [h4 gmp_rational]
@@ -418,6 +421,62 @@
 
 [mpq_eg]
 
+[h4 tommath_rational]
+
+   namespace boost{ namespace multiprecision{
+
+   typedef rational_adpater<tommath_int>        tommath_rational;
+   typedef mp_number<tommath_rational >         mp_rational;
+
+   }} // namespaces
+
+The `tommath_rational` backend is used via the typedef `boost::multiprecision::mp_rational`.  It acts as a thin wrapper around 
+`boost::rational<mp_int>`
+to provide a rational number type that is a drop-in replacement for the native C++ number types, but with unlimited precision.
+
+The advantage of using this type rather than `boost::rational<mp_int>` directly, is that it is expression-template enabled,
+greatly reducing the number of temporaries created in complex expressions.
+
+There are also non-member functions:
+
+   mp_int numerator(const mp_rational&);
+   mp_int denominator(const mp_rational&);
+
+which return the numerator and denominator of the number.
+
+[h5 Example:]
+
+[mp_rat_eg]
+
+[h4 Use With Boost.Rational]
+
+All of the inetger types in this library can be used as template arguments to `boost::rational<IntType>`.
+
+Note that using the library in this way largely negates the effect of the expression templates in `mp_number`.
+
+[h4 rational_adapter]
+
+   namespace boost{ namespace multiprecision{
+
+   template <class IntBackend> 
+   class rational_adpater;
+
+   }}
+
+The class template `rational_adapter` is a backend for `mp_number` which converts any existing integer backend
+into a rational-number backend.
+
+So for example, given an integer backend type `MyIntegerBackend`, the use would be something like:
+
+   typedef mp_number<MyIntegerBackend>                    MyInt;
+   typedef mp_number<rational_adapter<MyIntegerBackend> > MyRational;
+
+   MyRational r = 2;
+   r /= 3;
+   MyInt i = numerator(r);
+   assert(i == 2);
+
+
 [endsect]
 
 [endsect]
Added: sandbox/big_number/libs/multiprecision/example/tommath_snips.cpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/example/tommath_snips.cpp	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -0,0 +1,70 @@
+///////////////////////////////////////////////////////////////
+//  Copyright 2011 John Maddock. Distributed under the Boost
+//  Software License, Version 1.0. (See accompanying file
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+
+#include <boost/multiprecision/tommath.hpp>
+#include <iostream>
+
+void t1()
+{
+   //[tommath_eg
+   //=#include <boost/multiprecision/tommath.hpp>
+
+   boost::multiprecision::mp_int v = 1;
+
+   // Do some arithmetic:
+   for(unsigned i = 1; i <= 1000; ++i)
+      v *= i;
+
+   std::cout << v << std::endl; // prints 1000!
+   std::cout << std::hex << v << std::endl; // prints 1000! in hex format
+
+   try{
+      std::cout << std::hex << -v << std::endl; // Ooops! can't print a negative value in hex format!
+   }
+   catch(const std::runtime_error& e)
+   {
+      std::cout << e.what() << std::endl;
+   }
+
+   try{
+      // v is not a 2's complement type, bitwise operations are only supported
+      // on positive values:
+      v = -v & 2;
+   }
+   catch(const std::runtime_error& e)
+   {
+      std::cout << e.what() << std::endl;
+   }
+
+   //]
+}
+
+void t3()
+{
+   //[mp_rat_eg
+   //=#include <boost/multiprecision/tommath.hpp>
+
+   using namespace boost::multiprecision;
+
+   mp_rational v = 1;
+
+   // Do some arithmetic:
+   for(unsigned i = 1; i <= 1000; ++i)
+      v *= i;
+   v /= 10;
+
+   std::cout << v << std::endl; // prints 1000! / 10
+   std::cout << numerator(v) << std::endl;
+   std::cout << denominator(v) << std::endl;
+
+   //]
+}
+
+int main()
+{
+   t1();
+   return 0;
+}
+
Modified: sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp	(original)
+++ sandbox/big_number/libs/multiprecision/test/test_arithmetic.cpp	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -131,6 +131,18 @@
 void test_integer_ops(const T&){}
 
 template <class Real>
+void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
+{
+   Real a(2);
+   a /= 3;
+   BOOST_TEST(numerator(a) == 2);
+   BOOST_TEST(denominator(a) == 3);
+   Real b(4);
+   b /= 6;
+   BOOST_TEST(a == b);
+}
+
+template <class Real>
 void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
 {
    Real a(20);
Modified: sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp	(original)
+++ sandbox/big_number/libs/multiprecision/test/test_rational_io.cpp	2011-12-24 08:13:16 EST (Sat, 24 Dec 2011)
@@ -127,7 +127,7 @@
 #endif
 #ifdef TEST_TOMMATH
    test_round_trip<boost::rational<boost::multiprecision::mp_int> >();
-   test_round_trip<boost::multiprecision::mp_number<boost::multiprecision::rational_adapter<boost::multiprecision::tommath_int> > >();
+   test_round_trip<boost::multiprecision::mp_rational >();
 #endif
    return boost::report_errors();
 }