|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77851 - in sandbox/big_number/libs/multiprecision: doc doc/html doc/html/boost_multiprecision doc/html/boost_multiprecision/indexes doc/html/boost_multiprecision/map doc/html/boost_multiprecision/tut doc/html/boost_multiprecision/tut/floats doc/html/boost_multiprecision/tut/floats/fp_eg example example/generic_numerics_examples/generic_numerics_src
From: john_at_[hidden]
Date: 2012-04-09 12:58:32
Author: johnmaddock
Date: 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
New Revision: 77851
URL: http://svn.boost.org/trac/boost/changeset/77851
Log:
Integrate Chris's FP examples into the docs.
Added:
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg.html (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/GI.html (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/aos.html (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/jel.html (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/nd.html (contents, props changed)
sandbox/big_number/libs/multiprecision/doc/html4_symbols.qbk (contents, props changed)
Text files modified:
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html | 8
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html | 12
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html | 16
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html | 51 ++--
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html | 3
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html | 13 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html | 13 +
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html | 6
sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html | 6
sandbox/big_number/libs/multiprecision/doc/html/index.html | 15 +
sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk | 44 ++++
sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp | 373 +++++++++++++++++++++++++++++++++++++++
sandbox/big_number/libs/multiprecision/example/generic_numerics_examples/generic_numerics_src/generic_integral.cpp | 75 ++++---
13 files changed, 536 insertions(+), 99 deletions(-)
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -13,10 +13,10 @@
<div class="spirit-nav">
<a accesskey="p" href="../indexes.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s02.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id1095875">
+<div class="section id1089327">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id1095875"></a>Function Index</h3></div></div></div>
-<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_11">P</a> <a class="link" href="s01.html#idx_id_12">R</a> <a class="link" href="s01.html#idx_id_13">S</a> <a class="link" href="s01.html#idx_id_14">T</a> <a class="link" href="s01.html#idx_id_16">Z</a></p>
+<a name="id1089327"></a>Function Index</h3></div></div></div>
+<p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_11">P</a> <a class="link" href="s01.html#idx_id_12">R</a> <a class="link" href="s01.html#idx_id_13">S</a> <a class="link" href="s01.html#idx_id_14">T</a> <a class="link" href="s01.html#idx_id_15">Z</a></p>
<div class="variablelist"><dl>
<dt>
<a name="idx_id_0"></a><span class="term">A</span>
@@ -207,7 +207,7 @@
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_16"></a><span class="term">Z</span>
+<a name="idx_id_15"></a><span class="term">Z</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">zero</span></p>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -13,13 +13,13 @@
<div class="spirit-nav">
<a accesskey="p" href="s01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s03.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id1097052">
+<div class="section id1090260">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id1097052"></a>Class Index</h3></div></div></div>
-<p><a class="link" href="s02.html#idx_id_26">M</a> <a class="link" href="s02.html#idx_id_31">T</a></p>
+<a name="id1090260"></a>Class Index</h3></div></div></div>
+<p><a class="link" href="s02.html#idx_id_25">M</a> <a class="link" href="s02.html#idx_id_30">T</a></p>
<div class="variablelist"><dl>
<dt>
-<a name="idx_id_26"></a><span class="term">M</span>
+<a name="idx_id_25"></a><span class="term">M</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">mp_number</span></p>
@@ -29,11 +29,11 @@
</ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_31"></a><span class="term">T</span>
+<a name="idx_id_30"></a><span class="term">T</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">type</span></p>
-<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/jel.html" title="Worked Example: defining a mathematical function."><span class="index-entry-level-1">Worked Example: defining a mathematical function.</span></a></p></li></ul></div>
+<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/fp_eg/jel.html" title="Defining a Lambda Function."><span class="index-entry-level-1">Defining a Lambda Function.</span></a></p></li></ul></div>
</li></ul></div></dd>
</dl></div>
</div>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -13,13 +13,13 @@
<div class="spirit-nav">
<a accesskey="p" href="s02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s04.html"><img src="../../images/next.png" alt="Next"></a>
</div>
-<div class="section id1097139">
+<div class="section id1090347">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id1097139"></a>Typedef Index</h3></div></div></div>
-<p><a class="link" href="s03.html#idx_id_36">C</a> <a class="link" href="s03.html#idx_id_41">I</a> <a class="link" href="s03.html#idx_id_42">L</a> <a class="link" href="s03.html#idx_id_43">M</a> <a class="link" href="s03.html#idx_id_48">T</a></p>
+<a name="id1090347"></a>Typedef Index</h3></div></div></div>
+<p><a class="link" href="s03.html#idx_id_34">C</a> <a class="link" href="s03.html#idx_id_39">I</a> <a class="link" href="s03.html#idx_id_40">L</a> <a class="link" href="s03.html#idx_id_41">M</a> <a class="link" href="s03.html#idx_id_46">T</a></p>
<div class="variablelist"><dl>
<dt>
-<a name="idx_id_36"></a><span class="term">C</span>
+<a name="idx_id_34"></a><span class="term">C</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -47,21 +47,21 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_41"></a><span class="term">I</span>
+<a name="idx_id_39"></a><span class="term">I</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">int_type</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/primetest.html" title="Primality Testing"><span class="index-entry-level-1">Primality Testing</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_42"></a><span class="term">L</span>
+<a name="idx_id_40"></a><span class="term">L</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">limb_type</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/ints/cpp_int.html" title="cpp_int"><span class="index-entry-level-1">cpp_int</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_43"></a><span class="term">M</span>
+<a name="idx_id_41"></a><span class="term">M</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -161,7 +161,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_48"></a><span class="term">T</span>
+<a name="idx_id_46"></a><span class="term">T</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/rational/tommath_rational.html" title="tommath_rational"><span class="index-entry-level-0">tommath_rational</span></a></p></li>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -12,20 +12,20 @@
<div class="spirit-nav">
<a accesskey="p" href="s03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../indexes.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a>
</div>
-<div class="section id1097830">
+<div class="section id1091126">
<div class="titlepage"><div><div><h3 class="title">
-<a name="id1097830"></a>Index</h3></div></div></div>
-<p><a class="link" href="s04.html#idx_id_51">A</a> <a class="link" href="s04.html#idx_id_52">B</a> <a class="link" href="s04.html#idx_id_53">C</a> <a class="link" href="s04.html#idx_id_54">D</a> <a class="link" href="s04.html#idx_id_55">E</a> <a class="link" href="s04.html#idx_id_56">F</a> <a class="link" href="s04.html#idx_id_57">G</a> <a class="link" href="s04.html#idx_id_58">I</a> <a class="link" href="s04.html#idx_id_59">L</a> <a class="link" href="s04.html#idx_id_60">M</a> <a class="link" href="s04.html#idx_id_61">O</a> <a class="link" href="s04.html#idx_id_62">P</a> <a class="link" href="s04.html#idx_id_63">R</a> <a class="link" href="s04.html#idx_id_64">S</a> <a class="link" href="s04.html#idx_id_65">T</a> <a class="link" href="s04.html#idx_id_66">W</a> <a class="link" href="s04.html#idx_id_67">Z</a></p>
+<a name="id1091126"></a>Index</h3></div></div></div>
+<p><a class="link" href="s04.html#idx_id_48">A</a> <a class="link" href="s04.html#idx_id_49">B</a> <a class="link" href="s04.html#idx_id_50">C</a> <a class="link" href="s04.html#idx_id_51">D</a> <a class="link" href="s04.html#idx_id_52">E</a> <a class="link" href="s04.html#idx_id_53">F</a> <a class="link" href="s04.html#idx_id_54">G</a> <a class="link" href="s04.html#idx_id_55">I</a> <a class="link" href="s04.html#idx_id_56">L</a> <a class="link" href="s04.html#idx_id_57">M</a> <a class="link" href="s04.html#idx_id_58">O</a> <a class="link" href="s04.html#idx_id_59">P</a> <a class="link" href="s04.html#idx_id_60">R</a> <a class="link" href="s04.html#idx_id_61">S</a> <a class="link" href="s04.html#idx_id_62">T</a> <a class="link" href="s04.html#idx_id_63">Z</a></p>
<div class="variablelist"><dl>
<dt>
-<a name="idx_id_51"></a><span class="term">A</span>
+<a name="idx_id_48"></a><span class="term">A</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">abs</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_52"></a><span class="term">B</span>
+<a name="idx_id_49"></a><span class="term">B</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -50,7 +50,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_53"></a><span class="term">C</span>
+<a name="idx_id_50"></a><span class="term">C</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -106,7 +106,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_54"></a><span class="term">D</span>
+<a name="idx_id_51"></a><span class="term">D</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -123,26 +123,30 @@
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
+<p><span class="index-entry-level-0">Defining a Lambda Function.</span></p>
+<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/fp_eg/jel.html" title="Defining a Lambda Function."><span class="index-entry-level-1">type</span></a></p></li></ul></div>
+</li>
+<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">divide_qr</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_55"></a><span class="term">E</span>
+<a name="idx_id_52"></a><span class="term">E</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">eval_get_sign</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_56"></a><span class="term">F</span>
+<a name="idx_id_53"></a><span class="term">F</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">fpclassify</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_57"></a><span class="term">G</span>
+<a name="idx_id_54"></a><span class="term">G</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -175,7 +179,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_58"></a><span class="term">I</span>
+<a name="idx_id_55"></a><span class="term">I</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -223,7 +227,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_59"></a><span class="term">L</span>
+<a name="idx_id_56"></a><span class="term">L</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -252,7 +256,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_60"></a><span class="term">M</span>
+<a name="idx_id_57"></a><span class="term">M</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -410,14 +414,14 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_61"></a><span class="term">O</span>
+<a name="idx_id_58"></a><span class="term">O</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">Optional Requirements on the Backend Type</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_backend_type" title="Table 1.5. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_get_sign</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_62"></a><span class="term">P</span>
+<a name="idx_id_59"></a><span class="term">P</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -437,14 +441,14 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_63"></a><span class="term">R</span>
+<a name="idx_id_60"></a><span class="term">R</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">round</span></p>
<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/mp_number.html" title="mp_number"><span class="index-entry-level-1">mp_number</span></a></p></li></ul></div>
</li></ul></div></dd>
<dt>
-<a name="idx_id_64"></a><span class="term">S</span>
+<a name="idx_id_61"></a><span class="term">S</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -461,7 +465,7 @@
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_65"></a><span class="term">T</span>
+<a name="idx_id_62"></a><span class="term">T</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact>
<li class="listitem" style="list-style-type: none">
@@ -489,18 +493,11 @@
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">type</span></p>
-<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/jel.html" title="Worked Example: defining a mathematical function."><span class="index-entry-level-1">Worked Example: defining a mathematical function.</span></a></p></li></ul></div>
+<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/fp_eg/jel.html" title="Defining a Lambda Function."><span class="index-entry-level-1">Defining a Lambda Function.</span></a></p></li></ul></div>
</li>
</ul></div></dd>
<dt>
-<a name="idx_id_66"></a><span class="term">W</span>
-</dt>
-<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
-<p><span class="index-entry-level-0">Worked Example: defining a mathematical function.</span></p>
-<div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/floats/jel.html" title="Worked Example: defining a mathematical function."><span class="index-entry-level-1">type</span></a></p></li></ul></div>
-</li></ul></div></dd>
-<dt>
-<a name="idx_id_67"></a><span class="term">Z</span>
+<a name="idx_id_63"></a><span class="term">Z</span>
</dt>
<dd><div class="index"><ul class="index" type="none" compact><li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">zero</span></p>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -83,6 +83,9 @@
<li class="listitem">
Should there be a choice of rounding mode (probably MPFR specific)?
</li>
+<li class="listitem">
+ Document limits on size of cpp_dec_float.
+ </li>
</ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -29,8 +29,17 @@
<dt><span class="section">gmp_float</span></dt>
<dt><span class="section">mpfr_float</span></dt>
<dt><span class="section">cpp_dec_float</span></dt>
-<dt><span class="section"><a href="tut/floats/jel.html">Worked Example:
- defining a mathematical function.</a></span></dt>
+<dt><span class="section">Examples</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="tut/floats/fp_eg/aos.html">Area of
+ Circle</a></span></dt>
+<dt><span class="section"><a href="tut/floats/fp_eg/jel.html">Defining
+ a Lambda Function.</a></span></dt>
+<dt><span class="section"><a href="tut/floats/fp_eg/nd.html">Calculating
+ a Derivative</a></span></dt>
+<dt><span class="section"><a href="tut/floats/fp_eg/GI.html">Calculating
+ an Integral</a></span></dt>
+</dl></dd>
</dl></dd>
<dt><span class="section">Rational Number Types</span></dt>
<dd><dl>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -21,8 +21,17 @@
<dt><span class="section">gmp_float</span></dt>
<dt><span class="section">mpfr_float</span></dt>
<dt><span class="section">cpp_dec_float</span></dt>
-<dt><span class="section"><a href="floats/jel.html">Worked Example:
- defining a mathematical function.</a></span></dt>
+<dt><span class="section">Examples</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="floats/fp_eg/aos.html">Area of
+ Circle</a></span></dt>
+<dt><span class="section"><a href="floats/fp_eg/jel.html">Defining
+ a Lambda Function.</a></span></dt>
+<dt><span class="section"><a href="floats/fp_eg/nd.html">Calculating
+ a Derivative</a></span></dt>
+<dt><span class="section"><a href="floats/fp_eg/GI.html">Calculating
+ an Integral</a></span></dt>
+</dl></dd>
</dl></div>
<p>
The following back-ends provide floating point arithmetic:
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -7,11 +7,11 @@
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../floats.html" title="Floating Point Numbers">
<link rel="prev" href="mpfr_float.html" title="mpfr_float">
-<link rel="next" href="jel.html" title="Worked Example: defining a mathematical function.">
+<link rel="next" href="fp_eg.html" title="Examples">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="spirit-nav">
-<a accesskey="p" href="mpfr_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="jel.html"><img src="../../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="mpfr_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="fp_eg.html"><img src="../../../images/next.png" alt="Next"></a>
</div>
<div class="section boost_multiprecision_tut_floats_cpp_dec_float">
<div class="titlepage"><div><div><h4 class="title">
@@ -111,7 +111,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="mpfr_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="jel.html"><img src="../../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="mpfr_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="fp_eg.html"><img src="../../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Examples</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../floats.html" title="Floating Point Numbers">
+<link rel="prev" href="cpp_dec_float.html" title="cpp_dec_float">
+<link rel="next" href="fp_eg/aos.html" title="Area of Circle">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="cpp_dec_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="fp_eg/aos.html"><img src="../../../images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_multiprecision_tut_floats_fp_eg">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="boost_multiprecision.tut.floats.fp_eg"></a><a class="link" href="fp_eg.html" title="Examples">Examples</a>
+</h4></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="fp_eg/aos.html">Area of
+ Circle</a></span></dt>
+<dt><span class="section"><a href="fp_eg/jel.html">Defining
+ a Lambda Function.</a></span></dt>
+<dt><span class="section"><a href="fp_eg/nd.html">Calculating
+ a Derivative</a></span></dt>
+<dt><span class="section"><a href="fp_eg/GI.html">Calculating
+ an Integral</a></span></dt>
+</dl></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 © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="cpp_dec_float.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../floats.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="fp_eg/aos.html"><img src="../../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/GI.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/GI.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,161 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Calculating an Integral</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../fp_eg.html" title="Examples">
+<link rel="prev" href="nd.html" title="Calculating a Derivative">
+<link rel="next" href="../../rational.html" title="Rational Number Types">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="nd.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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>
+<div class="section boost_multiprecision_tut_floats_fp_eg_GI">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_multiprecision.tut.floats.fp_eg.GI"></a><a class="link" href="GI.html" title="Calculating an Integral">Calculating
+ an Integral</a>
+</h5></div></div></div>
+<p>
+ Similar to the generic derivative example, we can calculate integrals
+ in a similar manner:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">function_type</span><span class="special">></span>
+<span class="keyword">inline</span> <span class="identifier">value_type</span> <span class="identifier">integral</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">a</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">b</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">tol</span><span class="special">,</span>
+ <span class="identifier">function_type</span> <span class="identifier">func</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">unsigned</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">1U</span><span class="special">;</span>
+
+ <span class="identifier">value_type</span> <span class="identifier">h</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">-</span> <span class="identifier">a</span><span class="special">);</span>
+ <span class="identifier">value_type</span> <span class="identifier">I</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">func</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">func</span><span class="special">(</span><span class="identifier">b</span><span class="special">))</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">h</span> <span class="special">/</span> <span class="number">2</span><span class="special">);</span>
+
+ <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0U</span><span class="special">;</span> <span class="identifier">k</span> <span class="special"><</span> <span class="number">8U</span><span class="special">;</span> <span class="identifier">k</span><span class="special">++)</span>
+ <span class="special">{</span>
+ <span class="identifier">h</span> <span class="special">/=</span> <span class="number">2</span><span class="special">;</span>
+
+ <span class="identifier">value_type</span> <span class="identifier">sum</span><span class="special">(</span><span class="number">0</span><span class="special">);</span>
+ <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">1U</span><span class="special">;</span> <span class="identifier">j</span> <span class="special"><=</span> <span class="identifier">n</span><span class="special">;</span> <span class="identifier">j</span><span class="special">++)</span>
+ <span class="special">{</span>
+ <span class="identifier">sum</span> <span class="special">+=</span> <span class="identifier">func</span><span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">value_type</span><span class="special">((</span><span class="identifier">j</span> <span class="special">*</span> <span class="number">2</span><span class="special">)</span> <span class="special">-</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">h</span><span class="special">));</span>
+ <span class="special">}</span>
+
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">I0</span> <span class="special">=</span> <span class="identifier">I</span><span class="special">;</span>
+ <span class="identifier">I</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">I</span> <span class="special">/</span> <span class="number">2</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">h</span> <span class="special">*</span> <span class="identifier">sum</span><span class="special">);</span>
+
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">ratio</span> <span class="special">=</span> <span class="identifier">I0</span> <span class="special">/</span> <span class="identifier">I</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">delta</span> <span class="special">=</span> <span class="identifier">ratio</span> <span class="special">-</span> <span class="number">1</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">delta_abs</span> <span class="special">=</span> <span class="special">((</span><span class="identifier">delta</span> <span class="special"><</span> <span class="number">0</span><span class="special">)</span> <span class="special">?</span> <span class="special">-</span><span class="identifier">delta</span> <span class="special">:</span> <span class="identifier">delta</span><span class="special">);</span>
+
+ <span class="keyword">if</span><span class="special">((</span><span class="identifier">k</span> <span class="special">></span> <span class="number">1U</span><span class="special">)</span> <span class="special">&&</span> <span class="special">(</span><span class="identifier">delta_abs</span> <span class="special"><</span> <span class="identifier">tol</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">n</span> <span class="special">*=</span> <span class="number">2U</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">return</span> <span class="identifier">I</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following sample program shows how the function can be called, we
+ begin by defining a function object, which when integrated should yield
+ the Bessel J function:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">cyl_bessel_j_integral_rep</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">cyl_bessel_j_integral_rep</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">N</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">X</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">n</span><span class="special">(</span><span class="identifier">N</span><span class="special">),</span> <span class="identifier">x</span><span class="special">(</span><span class="identifier">X</span><span class="special">)</span> <span class="special">{</span> <span class="special">}</span>
+
+ <span class="identifier">value_type</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">value_type</span><span class="special">&</span> <span class="identifier">t</span><span class="special">)</span> <span class="keyword">const</span>
+ <span class="special">{</span>
+ <span class="comment">// pi * Jn(x) = Int_0^pi [cos(x * sin(t) - n*t) dt]</span>
+ <span class="keyword">return</span> <span class="identifier">cos</span><span class="special">(</span><span class="identifier">x</span> <span class="special">*</span> <span class="identifier">sin</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span> <span class="special">-</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">));</span>
+ <span class="special">}</span>
+
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">x</span><span class="special">;</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+<p>
+</p>
+<pre class="programlisting"> <span class="comment">/* The function can now be called as follows: */</span>
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">**)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">constants</span><span class="special">::</span><span class="identifier">pi</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span> <span class="identifier">mp_type</span><span class="special">;</span>
+
+ <span class="keyword">const</span> <span class="keyword">float</span> <span class="identifier">j2_f</span> <span class="special">=</span>
+ <span class="identifier">integral</span><span class="special">(</span><span class="number">0.0F</span><span class="special">,</span>
+ <span class="identifier">pi</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(),</span>
+ <span class="number">0.01F</span><span class="special">,</span>
+ <span class="identifier">cyl_bessel_j_integral_rep</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(</span><span class="number">2U</span><span class="special">,</span> <span class="number">1.23F</span><span class="special">))</span> <span class="special">/</span> <span class="identifier">pi</span><span class="special"><</span><span class="keyword">float</span><span class="special">>();</span>
+
+ <span class="keyword">const</span> <span class="keyword">double</span> <span class="identifier">j2_d</span> <span class="special">=</span>
+ <span class="identifier">integral</span><span class="special">(</span><span class="number">0.0</span><span class="special">,</span>
+ <span class="identifier">pi</span><span class="special"><</span><span class="keyword">double</span><span class="special">>(),</span>
+ <span class="number">0.0001</span><span class="special">,</span>
+ <span class="identifier">cyl_bessel_j_integral_rep</span><span class="special"><</span><span class="keyword">double</span><span class="special">>(</span><span class="number">2U</span><span class="special">,</span> <span class="number">1.23</span><span class="special">))</span> <span class="special">/</span> <span class="identifier">pi</span><span class="special"><</span><span class="keyword">double</span><span class="special">>();</span>
+
+ <span class="keyword">const</span> <span class="identifier">mp_type</span> <span class="identifier">j2_mp</span> <span class="special">=</span>
+ <span class="identifier">integral</span><span class="special">(</span><span class="identifier">mp_type</span><span class="special">(</span><span class="number">0</span><span class="special">),</span>
+ <span class="identifier">pi</span><span class="special"><</span><span class="identifier">mp_type</span><span class="special">>(),</span>
+ <span class="identifier">mp_type</span><span class="special">(</span><span class="number">1.0E-20</span><span class="special">),</span>
+ <span class="identifier">cyl_bessel_j_integral_rep</span><span class="special"><</span><span class="identifier">mp_type</span><span class="special">>(</span><span class="number">2U</span><span class="special">,</span> <span class="identifier">mp_type</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">/</span> <span class="number">100</span><span class="special">))</span> <span class="special">/</span> <span class="identifier">pi</span><span class="special"><</span><span class="identifier">mp_type</span><span class="special">>();</span>
+
+ <span class="comment">// 0.166369</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">float</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">j2_f</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">// 0.166369383786814</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">double</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">j2_d</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">// 0.16636938378681407351267852431513159437103348245333</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mp_type</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">j2_mp</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="comment">//</span>
+ <span class="comment">// Print true value for comparison:</span>
+ <span class="comment">// 0.166369383786814073512678524315131594371033482453329</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="identifier">mp_type</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">/</span> <span class="number">100</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="nd.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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>
+</body>
+</html>
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/aos.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/aos.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,118 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Area of Circle</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../fp_eg.html" title="Examples">
+<link rel="prev" href="../fp_eg.html" title="Examples">
+<link rel="next" href="jel.html" title="Defining a Lambda Function.">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="../fp_eg.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="jel.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_multiprecision_tut_floats_fp_eg_aos">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_multiprecision.tut.floats.fp_eg.aos"></a><a class="link" href="aos.html" title="Area of Circle">Area of
+ Circle</a>
+</h5></div></div></div>
+<p>
+ Generic numeric programming employs templates to use the same code for
+ different floating-point types and functions. Consider the area of a
+ circle a of radius r, given by
+ </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="emphasis"><em>a = π * r<sup>2</sup></em></span>
+ </p></blockquote></div>
+<p>
+ The area of a circle can be computed in generic programming using Boost.Math
+ for the constant π as shown below:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">constants</span><span class="special">/</span><span class="identifier">constants</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span>
+<span class="keyword">inline</span> <span class="identifier">T</span> <span class="identifier">area_of_a_circle</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">r</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">constants</span><span class="special">::</span><span class="identifier">pi</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">pi</span><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span> <span class="special">*</span> <span class="identifier">r</span> <span class="special">*</span> <span class="identifier">r</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ It is possible to use <code class="computeroutput"><span class="identifier">area_of_a_circle</span><span class="special">()</span></code> with built-in floating-point types
+ as well as floating-point types from Boost.Multiprecision. In particular,
+ consider a system with 4-byte single-precision float, 8-byte double-precision
+ double and also the <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>
+ data type from Boost.Multiprecision with 50 decimal digits of precision.
+ </p>
+<p>
+ We can compute and print the approximate area of a circle with radius
+ 123/100 for <code class="computeroutput"><span class="keyword">float</span></code>, <code class="computeroutput"><span class="keyword">double</span></code> and <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>
+ with the program below.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iomanip</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_dec_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span><span class="special">;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">**)</span>
+<span class="special">{</span>
+ <span class="keyword">const</span> <span class="keyword">float</span> <span class="identifier">r_f</span><span class="special">(</span><span class="keyword">float</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">/</span> <span class="number">100</span><span class="special">);</span>
+ <span class="keyword">const</span> <span class="keyword">float</span> <span class="identifier">a_f</span> <span class="special">=</span> <span class="identifier">area_of_a_circle</span><span class="special">(</span><span class="identifier">r_f</span><span class="special">);</span>
+
+ <span class="keyword">const</span> <span class="keyword">double</span> <span class="identifier">r_d</span><span class="special">(</span><span class="keyword">double</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">/</span> <span class="number">100</span><span class="special">);</span>
+ <span class="keyword">const</span> <span class="keyword">double</span> <span class="identifier">a_d</span> <span class="special">=</span> <span class="identifier">area_of_a_circle</span><span class="special">(</span><span class="identifier">r_d</span><span class="special">);</span>
+
+ <span class="keyword">const</span> <span class="identifier">cpp_dec_float_50</span> <span class="identifier">r_mp</span><span class="special">(</span><span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">/</span> <span class="number">100</span><span class="special">);</span>
+ <span class="keyword">const</span> <span class="identifier">cpp_dec_float_50</span> <span class="identifier">a_mp</span> <span class="special">=</span> <span class="identifier">area_of_a_circle</span><span class="special">(</span><span class="identifier">r_mp</span><span class="special">);</span>
+
+ <span class="comment">// 4.75292</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">float</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">a_f</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">// 4.752915525616</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">double</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">a_d</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">// 4.7529155256159981904701331745635599135018975843146</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">a_mp</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ In the next example we'll look at calling both standard library and Boost.Math
+ functions from within generic code. We'll also show how to cope with
+ template arguments which are expression-templates rather than number
+ types.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../fp_eg.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="jel.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/jel.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/jel.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,222 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Defining a Lambda Function.</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../fp_eg.html" title="Examples">
+<link rel="prev" href="aos.html" title="Area of Circle">
+<link rel="next" href="nd.html" title="Calculating a Derivative">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="aos.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="nd.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_multiprecision_tut_floats_fp_eg_jel">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_multiprecision.tut.floats.fp_eg.jel"></a><a class="link" href="jel.html" title="Defining a Lambda Function.">Defining
+ a Lambda Function.</a>
+</h5></div></div></div>
+<p>
+ In this example we'll show several implementations of the <a href="http://mathworld.wolfram.com/LambdaFunction.html" target="_top">Jahnke
+ and Emden Lambda function</a>, each implementation a little more
+ sophisticated than the last.
+ </p>
+<p>
+ The Jahnke-Emden Lambda function is defined by the equation:
+ </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="emphasis"><em>JahnkeEmden(v, z) = Γ(v+1) * J<sub>v</sub>(z) / (z / 2)<sup>v</sup></em></span>
+ </p></blockquote></div>
+<p>
+ If we were to implement this at double precision using Boost.Math's facilities
+ for the Gamma and Bessel function calls it would look like this:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">JEL1</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">v</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">z</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span><span class="special">(</span><span class="identifier">z</span> <span class="special">/</span> <span class="number">2</span><span class="special">,</span>
<span class="identifier">v</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Calling this function as:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">scientific</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">double</span><span class="special">>::</span><span class="identifier">digits10</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">JEL1</span><span class="special">(</span><span class="number">2.5</span><span class="special">,</span> <span class="number">0.5</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>
+ Yields the output:
+ </p>
+<pre class="programlisting">9.822663964796047e-001</pre>
+<p>
+ Now lets implement the function again, but this time using the multiprecision
+ type <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>
+ as the argument type:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span>
+ <span class="identifier">JEL2</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span> <span class="identifier">z</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">z</span><span class="special">)</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">pow</span><span class="special">(</span><span class="identifier">z</span> <span class=
"special">/</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The implementation is almost the same as before, but with one key difference
+ - we can no longer call <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span></code>,
+ instead we must call the version inside the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span></code>
+ namespace. In point of fact, we could have omitted the namespace prefix
+ on the call to <code class="computeroutput"><span class="identifier">pow</span></code> since
+ the right overload would have been found via <a href="http://en.wikipedia.org/wiki/Argument-dependent_name_lookup" target="_top">argument
+ dependent lookup</a> in any case.
+ </p>
+<p>
+ Note also that the first argument to <code class="computeroutput"><span class="identifier">pow</span></code>
+ along with the argument to <code class="computeroutput"><span class="identifier">tgamma</span></code>
+ in the above code are actually expression templates. The <code class="computeroutput"><span class="identifier">pow</span></code> and <code class="computeroutput"><span class="identifier">tgamma</span></code>
+ functions will handle these arguments just fine.
+ </p>
+<p>
+ Here's an example of how the function may be called:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">scientific</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>::</span><span class="identifier">digits10</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">JEL2</span><span class="special">(</span><span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">2.5</span><span class="special">),</span> <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">0.5</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>
+ Which outputs:
+ </p>
+<pre class="programlisting">9.82266396479604757017335009796882833995903762577173e-01</pre>
+<p>
+ Now that we've seen some non-template examples, lets repeat the code
+ again, but this time as a template that can be called either with a builtin
+ type (<code class="computeroutput"><span class="keyword">float</span></code>, <code class="computeroutput"><span class="keyword">double</span></code> etc), or with a multiprecision
+ type:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Float</span><span class="special">></span>
+<span class="identifier">Float</span> <span class="identifier">JEL3</span><span class="special">(</span><span class="identifier">Float</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">Float</span> <span class="identifier">z</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">pow</span><span class="special">(</span><span class="identifier">z</span> <span class="special">/</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Once again the code is almost the same as before, but the call to <code class="computeroutput"><span class="identifier">pow</span></code> has changed yet again. We need
+ the call to resolve to either <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span></code>
+ (when the argument is a builtin type), or to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">pow</span></code>
+ (when the argument is a multiprecision type). We do that by making the
+ call unqualified so that versions of <code class="computeroutput"><span class="identifier">pow</span></code>
+ defined in the same namespace as type <code class="computeroutput"><span class="identifier">Float</span></code>
+ are found via argument dependent lookup, while the <code class="computeroutput"><span class="keyword">using</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span></code> directive makes the standard library
+ versions visible for builtin floating point types.
+ </p>
+<p>
+ Let's call the function with both <code class="computeroutput"><span class="keyword">double</span></code>
+ and multiprecision arguments:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">scientific</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">double</span><span class="special">>::</span><span class="identifier">digits10</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">JEL3</span><span class="special">(</span><span class="number">2.5</span><span class="special">,</span> <span class="number">0.5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">scientific</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>::</span><span class="identifier">digits10</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">JEL3</span><span class="special">(</span><span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">2.5</span><span class="special">),</span> <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">0.5</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>
+ Which outputs:
+ </p>
+<pre class="programlisting">9.822663964796047e-001
+9.82266396479604757017335009796882833995903762577173e-01
+</pre>
+<p>
+ Unfortunately there is a problem with this version: if we were to call
+ it like this:
+ </p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span> <span class="identifier">v</span><span class="special">(</span><span class="number">2</span><span class="special">),</span> <span class="identifier">z</span><span class="special">(</span><span class="number">0.5</span><span class="special">);</span>
+<span class="identifier">JEL3</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">0.5</span><span class="special">,</span> <span class="identifier">z</span><span class="special">);</span>
+</pre>
+<p>
+ Then we would get a long and inscrutable error message from the compiler:
+ the problem here is that the first argument to <code class="computeroutput"><span class="identifier">JEL3</span></code>
+ is not a number type, but an expression template. We could obviously
+ add a typecast to fix the issue:
+ </p>
+<pre class="programlisting"><span class="identifier">JEL</span><span class="special">(</span><span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">0.5</span><span class="special">),</span> <span class="identifier">z</span><span class="special">);</span>
+</pre>
+<p>
+ However, if we want the function JEL to be truely reusable, then a better
+ solution might be preferred. To achieve this we can borrow some code
+ from Boost.Math which calculates the return type of mixed-argument functions,
+ here's how the new code looks now:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Float1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Float2</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tools</span><span class="special">::</span><span class="identifier">promote_args</span><span class="special"><</span><span class="identifier">Float1</span><span class="special">,</span> <span class="identifier">Float2</span><span class="special">>::</span><span class="identifier">type</span>
+ <span class="identifier">JEL4</span><span class="special">(</span><span class="identifier">Float1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">Float2</span> <span class="identifier">z</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">pow</span><span class="special">(</span><span class="identifier">z</span> <span class="special">/</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ As you can see the two arguments to the function are now separate template
+ types, and the return type is computed using the <code class="computeroutput"><span class="identifier">promote_args</span></code>
+ metafunction from Boost.Math.
+ </p>
+<p>
+ Now we can call:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">scientific</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">digits10</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">JEL4</span><span class="special">(</span><span class="identifier">cpp_dec_float_100</span><span class="special">(</span><span class="number">2</span><span class="special">)</span> <span class="special">+</span> <span class="number">0.5</span><span class="special">,</span> <span class="identifier">cpp_dec_float_100</span><span class="special">(</span><span class="number">0.5</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>
+ And get 100 digits of output:
+ </p>
+<pre class="programlisting">9.8226639647960475701733500979688283399590376257717309069410413822165082248153638454147004236848917775e-01</pre>
+<p>
+ As a bonus, we can now call the function not just with expression templates,
+ but with other mixed types as well: for example <code class="computeroutput"><span class="keyword">float</span></code>
+ and <code class="computeroutput"><span class="keyword">double</span></code> or <code class="computeroutput"><span class="keyword">int</span></code> and <code class="computeroutput"><span class="keyword">double</span></code>,
+ and the correct return type will be computed in each case.
+ </p>
+<p>
+ Note that while in this case we didn't have to change the body of the
+ function, in the general case any function like this which creates local
+ variables internally would have to use <code class="computeroutput"><span class="identifier">promote_args</span></code>
+ to work out what type those variables should be, for example:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Float1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Float2</span><span class="special">></span>
+<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tools</span><span class="special">::</span><span class="identifier">promote_args</span><span class="special"><</span><span class="identifier">Float1</span><span class="special">,</span> <span class="identifier">Float2</span><span class="special">>::</span><span class="identifier">type</span>
+ <span class="identifier">JEL5</span><span class="special">(</span><span class="identifier">Float1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">Float2</span> <span class="identifier">z</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tools</span><span class="special">::</span><span class="identifier">promote_args</span><span class="special"><</span><span class="identifier">Float1</span><span class="special">,</span> <span class="identifier">Float2</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">variable_type</span><span class="special">;</span>
+ <span class="identifier">variable_type</span> <span class="identifier">t</span> <span class="special">=</span> <span class="identifier">pow</span><span class="special">(</span><span class="identifier">z</span> <span class="special">/</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">v</span> <span class="special">+</span> <span class="number">1</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">z</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">t</span><span class="special">;</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>
+<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="aos.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="nd.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/nd.html
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/fp_eg/nd.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,202 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Calculating a Derivative</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.Multiprecision">
+<link rel="up" href="../fp_eg.html" title="Examples">
+<link rel="prev" href="jel.html" title="Defining a Lambda Function.">
+<link rel="next" href="GI.html" title="Calculating an Integral">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="spirit-nav">
+<a accesskey="p" href="jel.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="GI.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_multiprecision_tut_floats_fp_eg_nd">
+<div class="titlepage"><div><div><h5 class="title">
+<a name="boost_multiprecision.tut.floats.fp_eg.nd"></a><a class="link" href="nd.html" title="Calculating a Derivative">Calculating
+ a Derivative</a>
+</h5></div></div></div>
+<p>
+ In this example we'll add even more power to generic numeric programming
+ using not only different floating-point types but also function objects
+ as template parameters. Consider some well-known central difference rules
+ for numerically computing the first derivative of a function <span class="emphasis"><em>f′(x)</em></span>
+ with <span class="emphasis"><em>x ∈ ℜ</em></span>:
+ </p>
+<p>
+ <span class="inlinemediaobject"><img src="../../../../../floating_point_eg1.png"></span>
+ </p>
+<p>
+ Where the difference terms <span class="emphasis"><em>m<sub>n</sub></em></span> are given by:
+ </p>
+<p>
+ <span class="inlinemediaobject"><img src="../../../../../floating_point_eg2.png"></span>
+ </p>
+<p>
+ and <span class="emphasis"><em>dx</em></span> is the step-size of the derivative.
+ </p>
+<p>
+ The third formula in Equation 1 is a three-point central difference rule.
+ It calculates the first derivative of <span class="emphasis"><em>f′(x)</em></span> to <span class="emphasis"><em>O(dx<sup>6</sup>)</em></span>,
+ where <span class="emphasis"><em>dx</em></span> is the given step-size. For example, if
+ the step-size is 0.01 this derivative calculation has about 6 decimal
+ digits of precision - just about right for the 7 decimal digits of single-precision
+ float. Let's make a generic template subroutine using this three-point
+ central difference rule. In particular:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">value_type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">function_type</span><span class="special">></span>
+ <span class="identifier">value_type</span> <span class="identifier">derivative</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">dx</span><span class="special">,</span> <span class="identifier">function_type</span> <span class="identifier">func</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="comment">// Compute d/dx[func(*first)] using a three-point</span>
+ <span class="comment">// central difference rule of O(dx^6).</span>
+
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">dx1</span> <span class="special">=</span> <span class="identifier">dx</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">dx2</span> <span class="special">=</span> <span class="identifier">dx1</span> <span class="special">*</span> <span class="number">2</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">dx3</span> <span class="special">=</span> <span class="identifier">dx1</span> <span class="special">*</span> <span class="number">3</span><span class="special">;</span>
+
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">m1</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">dx1</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">-</span> <span class="identifier">dx1</span><span class="special">))</span> <span class="special">/</span> <span class="number">2</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">m2</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">dx2</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">-</span> <span class="identifier">dx2</span><span class="special">))</span> <span class="special">/</span> <span class="number">4</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">m3</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">dx3</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">func</span><span class="special">(</span><span class="identifier">x</span> <span class="special">-</span> <span class="identifier">dx3</span><span class="special">))</span> <span class="special">/</span> <span class="number">6</span><span class="special">;</span>
+
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">fifteen_m1</span> <span class="special">=</span> <span class="number">15</span> <span class="special">*</span> <span class="identifier">m1</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">six_m2</span> <span class="special">=</span> <span class="number">6</span> <span class="special">*</span> <span class="identifier">m2</span><span class="special">;</span>
+ <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="identifier">ten_dx1</span> <span class="special">=</span> <span class="number">10</span> <span class="special">*</span> <span class="identifier">dx1</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="special">((</span><span class="identifier">fifteen_m1</span> <span class="special">-</span> <span class="identifier">six_m2</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">m3</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">ten_dx1</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The <code class="computeroutput"><span class="identifier">derivative</span><span class="special">()</span></code>
+ template function can be used to compute the first derivative of any
+ function to <span class="emphasis"><em>O(dx<sup>6</sup>)</em></span>. For example, consider the first
+ derivative of <span class="emphasis"><em>sin(x)</em></span> evaluated at <span class="emphasis"><em>x =
+ π/3</em></span>. In other words,
+ </p>
+<p>
+ <span class="inlinemediaobject"><img src="../../../../../floating_point_eg3.png"></span>
+ </p>
+<p>
+ The code below computes the derivative in Equation 3 for float, double
+ and boost's multiple-precision type cpp_dec_float_50.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iomanip</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_dec_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">constants</span><span class="special">/</span><span class="identifier">constants</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">**)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">constants</span><span class="special">::</span><span class="identifier">pi</span><span class="special">;</span>
+ <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span><span class="special">;</span>
+ <span class="comment">//</span>
+ <span class="comment">// We'll pass a function pointer for the function object passed to derivative,</span>
+ <span class="comment">// the typecast is needed to select the correct overload of std::sin:</span>
+ <span class="comment">//</span>
+ <span class="keyword">const</span> <span class="keyword">float</span> <span class="identifier">d_f</span> <span class="special">=</span> <span class="identifier">derivative</span><span class="special">(</span>
+ <span class="identifier">pi</span><span class="special"><</span><span class="keyword">float</span><span class="special">>()</span> <span class="special">/</span> <span class="number">3</span><span class="special">,</span>
+ <span class="number">0.01F</span><span class="special">,</span>
+ <span class="keyword">static_cast</span><span class="special"><</span><span class="keyword">float</span><span class="special">(*)(</span><span class="keyword">float</span><span class="special">)>(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">sin</span><span class="special">)</span>
+ <span class="special">);</span>
+
+ <span class="keyword">const</span> <span class="keyword">double</span> <span class="identifier">d_d</span> <span class="special">=</span> <span class="identifier">derivative</span><span class="special">(</span>
+ <span class="identifier">pi</span><span class="special"><</span><span class="keyword">double</span><span class="special">>()</span> <span class="special">/</span> <span class="number">3</span><span class="special">,</span>
+ <span class="number">0.001</span><span class="special">,</span>
+ <span class="keyword">static_cast</span><span class="special"><</span><span class="keyword">double</span><span class="special">(*)(</span><span class="keyword">double</span><span class="special">)>(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">sin</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="comment">//</span>
+ <span class="comment">// In the cpp_dec_float_50 case, the sin function is multiply overloaded</span>
+ <span class="comment">// to handle expression templates etc. As a result it's hard to take it's</span>
+ <span class="comment">// address without knowing about its implementation details. We'll use a </span>
+ <span class="comment">// C++11 lambda expression to capture the call.</span>
+ <span class="comment">// We also need a typecast on the first argument so we don't accidently pass</span>
+ <span class="comment">// an expression template to a template function:</span>
+ <span class="comment">//</span>
+ <span class="keyword">const</span> <span class="identifier">cpp_dec_float_50</span> <span class="identifier">d_mp</span> <span class="special">=</span> <span class="identifier">derivative</span><span class="special">(</span>
+ <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="identifier">pi</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>()</span> <span class="special">/</span> <span class="number">3</span><span class="special">),</span>
+ <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">1.0E-9</span><span class="special">),</span>
+ <span class="special">[](</span><span class="keyword">const</span> <span class="identifier">cpp_dec_float_50</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">-></span> <span class="identifier">cpp_dec_float_50</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">sin</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span>
+ <span class="special">}</span>
+ <span class="special">);</span>
+
+ <span class="comment">// 5.000029e-001</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">float</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">d_f</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">// 4.999999999998876e-001</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="keyword">double</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">d_d</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">// 4.99999999999999999999999999999999999999999999999999e-01</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">d_mp</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The expected value of the derivative is 0.5. This central difference
+ rule in this example is ill-conditioned, meaning it suffers from slight
+ loss of precision. With that in mind, the results agree with the expected
+ value of 0.5.
+ </p>
+<p>
+ We can take this a step further and use our derivative function to compute
+ a partial derivative. For example if we take the incomplete gamma function
+ <span class="emphasis"><em>P(a, z)</em></span>, and take the derivative with respect to
+ <span class="emphasis"><em>z</em></span> at <span class="emphasis"><em>(2,2)</em></span> then we can calculate
+ the result as shown below, for good measure we'll compare with the "correct"
+ result obtained from a call to <span class="emphasis"><em>gamma_p_derivative</em></span>,
+ the results agree to approximately 44 digits:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">cpp_dec_float_50</span> <span class="identifier">gd</span> <span class="special">=</span> <span class="identifier">derivative</span><span class="special">(</span>
+ <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">2</span><span class="special">),</span>
+ <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">1.0E-9</span><span class="special">),</span>
+ <span class="special">[](</span><span class="keyword">const</span> <span class="identifier">cpp_dec_float_50</span><span class="special">&</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">-></span><span class="identifier">cpp_dec_float_50</span>
+ <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">gamma_p</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
+ <span class="special">}</span>
+<span class="special">);</span>
+<span class="comment">// 2.70670566473225383787998989944968806815263091819151e-01</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">)</span>
+ <span class="special"><<</span> <span class="identifier">gd</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">// 2.70670566473225383787998989944968806815253190143120e-01</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">gamma_p_derivative</span><span class="special">(</span><span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">2</span><span class="special">),</span> <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">2</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>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright © 2002-2012 John Maddock and Christopher Kormanyos<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="jel.html"><img src="../../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../fp_eg.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="GI.html"><img src="../../../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Modified: sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/tut/rational.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -6,12 +6,12 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Multiprecision">
<link rel="up" href="../tut.html" title="Tutorial">
-<link rel="prev" href="floats/jel.html" title="Worked Example: defining a mathematical function.">
+<link rel="prev" href="floats/fp_eg/GI.html" title="Calculating an Integral">
<link rel="next" href="rational/gmp_rational.html" title="gmp_rational">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="spirit-nav">
-<a accesskey="p" href="floats/jel.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/gmp_rational.html"><img src="../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="floats/fp_eg/GI.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/gmp_rational.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section boost_multiprecision_tut_rational">
<div class="titlepage"><div><div><h3 class="title">
@@ -246,7 +246,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="floats/jel.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/gmp_rational.html"><img src="../../images/next.png" alt="Next"></a>
+<a accesskey="p" href="floats/fp_eg/GI.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/gmp_rational.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -44,8 +44,17 @@
<dt><span class="section">gmp_float</span></dt>
<dt><span class="section">mpfr_float</span></dt>
<dt><span class="section">cpp_dec_float</span></dt>
-<dt><span class="section"><a href="boost_multiprecision/tut/floats/jel.html">Worked Example:
- defining a mathematical function.</a></span></dt>
+<dt><span class="section">Examples</span></dt>
+<dd><dl>
+<dt><span class="section"><a href="boost_multiprecision/tut/floats/fp_eg/aos.html">Area of
+ Circle</a></span></dt>
+<dt><span class="section"><a href="boost_multiprecision/tut/floats/fp_eg/jel.html">Defining
+ a Lambda Function.</a></span></dt>
+<dt><span class="section"><a href="boost_multiprecision/tut/floats/fp_eg/nd.html">Calculating
+ a Derivative</a></span></dt>
+<dt><span class="section"><a href="boost_multiprecision/tut/floats/fp_eg/GI.html">Calculating
+ an Integral</a></span></dt>
+</dl></dd>
</dl></dd>
<dt><span class="section">Rational Number Types</span></dt>
<dd><dl>
@@ -101,7 +110,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: April 03, 2012 at 18:14:12 GMT</small></p></td>
+<td align="left"><p><small>Last revised: April 09, 2012 at 16:55:19 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Added: sandbox/big_number/libs/multiprecision/doc/html4_symbols.qbk
==============================================================================
--- (empty file)
+++ sandbox/big_number/libs/multiprecision/doc/html4_symbols.qbk 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -0,0 +1,215 @@
+[/ Symbols and Greek letters (about 120) from HTML4.]
+[/ File HTML4_symbols.qbk]
+[/ See http://www.htmlhelp.com/reference/html40/entities/symbols.html]
+[/ See also http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references]
+[/ http://www.alanwood.net/demos/ent4_frame.html]
+[/ http://www.unicode.org/charts/PDF/U2200.pdf and others]
+[/ All (except 2 angle brackets) show OK on Firefox 2.0]
+
+[/ See also Latin-1 aka Western (ISO-8859-1) in latin1_symbols.qbk]
+[/ http://www.htmlhelp.com/reference/html40/entities/latin1.html]
+[/Unicode Latin extended http://www.unicode.org/charts/U0080.pdf]
+
+[/ Also some miscellaneous math charaters added to this list - see the end.]
+[/ For others see also math_symbols.qbk]
+
+[/ To use, enclose the template name in square brackets.]
+
+[template fnof[]'''ƒ'''] [/ Latin small f with hook = function = florin]
+[/ Capital Greek start with capital letter, lower case all small.]
+[template Alpha[]'''Α'''] [/ ? Greek capital letter alpha]
+[template Beta[]'''Β'''] [/ ? Greek capital letter beta]
+[template Gamma[]'''Γ'''] [/ G Greek capital letter gamma]
+[template Delta[]'''Δ'''] [/ ? Greek capital letter delta]
+[template Epsilon[]'''Ε'''] [/ ? Greek capital letter epsilon]
+[template Zeta[]'''Ζ'''] [/ ? Greek capital letter zeta]
+[template Eta[]'''Η'''] [/ ? Greek capital letter eta]
+[template Theta[]'''Θ'''] [/ T Greek capital letter theta]
+[template Iota[]'''Ι'''] [/ ? Greek capital letter iota]
+[template Kappa[]'''Κ'''] [/ ? Greek capital letter kappa]
+[template Lambda[]'''Λ'''] [/ ? Greek capital letter lambda]
+[template Mu[]'''Μ'''] [/ ? Greek capital letter mu]
+[template Nu[]'''Ν'''] [/ ? Greek capital letter nu]
+[template Xi[]'''Ξ'''] [/ ? Greek capital letter xi]
+[template Omicron[]'''Ο'''] [/ ? Greek capital letter omicron]
+[template Pi[]'''Π'''] [/ ? Greek capital letter pi]
+[template Rho[]'''Ρ'''] [/ ? Greek capital letter rho]
+[template Sigma[]'''Σ'''] [/ S Greek capital letter sigma]
+[template Tau[]'''Τ'''] [/ ? Greek capital letter tau]
+[template Upsilon[]'''Υ'''] [/ ? Greek capital letter upsilon]
+[template Phi[]'''Φ'''] [/ F Greek capital letter phi]
+[template Chi[]'''Χ'''] [/ ? Greek capital letter chi]
+[template Psi[]'''Ψ'''] [/ ? Greek capital letter psi]
+[template Omega[]'''Ω'''] [/ O Greek capital letter omega]
+[template alpha[]'''α'''] [/ a Greek small letter alpha]
+[template beta[]'''β'''] [/ ß Greek small letter beta]
+[template gamma[]'''γ'''] [/ ? Greek small letter gamma]
+[template delta[]'''δ'''] [/ d Greek small letter delta]
+[template epsilon[]'''ε'''] [/ e Greek small letter epsilon]
+[template zeta[]'''ζ'''] [/ ? Greek small letter zeta]
+[template eta[]'''η'''] [/ ? Greek small letter eta]
+[template theta[]'''θ'''] [/ ? Greek small letter theta]
+[template iota[]'''ι'''] [/ ? Greek small letter iota]
+[template kappa[]'''κ'''] [/ ? Greek small letter kappa]
+[template lambda[]'''λ'''] [/ ? Greek small letter lambda]
+[template mu[]'''μ'''] [/ µ Greek small letter mu]
+[template nu[]'''ν'''] [/ ? Greek small letter nu]
+[template xi[]'''ξ'''] [/ ? Greek small letter xi]
+[template omicron[]'''ο'''] [/ ? Greek small letter omicron]
+[template pi[]'''π'''] [/ p Greek small letter pi]
+[template rho[]'''ρ'''] [/ ? Greek small letter rho]
+[template sigmaf[]'''ς'''] [/ ? Greek small letter final sigma]
+[template sigma[]'''σ'''] [/ s Greek small letter sigma]
+[template tau[]'''τ'''] [/ t Greek small letter tau]
+[template upsilon[]'''υ'''] [/ ? Greek small letter upsilon]
+[template phi[]'''φ'''] [/ f Greek small letter phi]
+[template chi[]'''χ'''] [/ ? Greek small letter chi]
+[template psi[]'''ψ'''] [/ ? Greek small letter psi]
+[template omega[]'''ω'''] [/ ? Greek small letter omega]
+[template thetasym[]'''ϑ'''] [/ ? Greek small letter theta symbol]
+[template upsih[]'''ϒ'''] [/ ? Greek upsilon with hook symbol]
+[template piv[]'''ϖ'''] [/ ? Greek pi symbol]
+
+[template bull[]'''•'''] [/ bullet = black small circle]
+[template hellip[]'''…'''] [/
horizontal ellipsis = three dot leader]
+[template prime[]'''′'''] [/ ' prime = minutes = feet]
+[template Prime[]'''″'''] [/ ? double prime = seconds = inches]
+[template oline[]'''‾'''] [/ ? overline = spacing overscore]
+[template frasl[]'''⁄'''] [/ / fraction slash]
+[template weierp[]'''℘'''] [/ P script capital P = power set = Weierstrass p]
+[template image[]'''ℑ'''] [/ I blackletter capital I = imaginary part]
+[template real[]'''ℜ'''] [/ R blackletter capital R = real part symbol]
+[template trade[]'''™'''] [/ trade mark sign]
+[template alefsym[]'''ℵ'''] [/ ? alef symbol = first transfinite cardinal]
+[template larr[]'''←'''] [/ ? leftwards arrow]
+[template uarr[]'''↑'''] [/ ? upwards arrow]
+[template rarr[]'''→'''] [/ ? rightwards arrow]
+[template darr[]'''↓'''] [/ ? downwards arrow]
+[template harr[]'''↔'''] [/ ? left right arrow]
+[template crarr[]'''↵'''] [/ ? downwards arrow with corner leftwards = CR]
+[template lArr[]'''⇐'''] [/ ? leftwards double arrow]
+[template uArr[]'''⇑'''] [/ ? upwards double arrow]
+[template rArr[]'''⇒'''] [/ ? rightwards double arrow]
+[template dArr[]'''⇓'''] [/ ? downwards double arrow]
+[template hArr[]'''⇔'''] [/ ? left right double arrow]
+[template forall[]'''∀'''] [/ ? for all]
+[template part[]'''∂'''] [/ ? partial differential]
+[template exist[]'''∃'''] [/ ? there exists]
+[template empty[]'''∅'''] [/ Ø empty set = null set = diameter]
+[template nabla[]'''∇'''] [/ ? nabla = backward difference]
+[template isin[]'''∈'''] [/ ? element of]
+[template notin[]'''∉'''] [/ ? not an element of]
+[template ni[]'''∋'''] [/ ? contains as member]
+[template prod[]'''∏'''] [/ ? n-ary product = product sign]
+[template sum[]'''∑'''] [/ ? n-ary sumation]
+[template minus[]'''−'''] [/ - minus sign]
+[template lowast[]'''∗'''] [/ * asterisk operator]
+[template radic[]'''√'''] [/ v square root = radical sign]
+[template prop[]'''∝'''] [/ ? proportional to]
+[template infin[]'''∞'''] [/ 8 infinity]
+[template ang[]'''∠'''] [/ ? angle]
+[template and[]'''∧'''] [/ ? logical and = wedge]
+[template or[]'''∨'''] [/ ? logical or = vee]
+[template cap[]'''∩'''] [/ n intersection = cap]
+[template cup[]'''∪'''] [/ ? union = cup]
+[template int[]'''∫'''] [/ ? integral]
+[template there4[]'''∴'''] [/ ? therefore]
+[template sim[]'''∼'''] [/ ~ tilde operator = varies with = similar to]
+[template cong[]'''≅'''] [/ ? approximately equal to]
+[template asymp[]'''≈'''] [/ almost equal to = asymptotic to]
+[template ne[]'''≠'''] [/ ? not equal to]
+[template equiv[]'''≡'''] [/ = identical to]
+[template le[]'''≤'''] [/ = less-than or equal to]
+[template ge[]'''≥'''] [/ = greater-than or equal to]
+[template subset[]'''⊂'''] [/ ? subset of]
+[template superset[]'''⊃'''] [/ ? superset of]
+[template nsubset[]'''⊄'''] [/ ? not a subset of]
+[template sube[]'''⊆'''] [/ ? subset of or equal to]
+[template supe[]'''⊇'''] [/ ? superset of or equal to]
+[template oplus[]'''⊕'''] [/ ? circled plus = direct sum]
+[template otimes[]'''⊗'''] [/ ? circled times = vector product]
+[template perp[]'''⊥'''] [/ ? up tack = orthogonal to = perpendicular]
+[template sdot[]'''⋅'''] [/ · dot operator]
+[template lceil[]'''⌈'''] [/ ? left ceiling = APL upstile]
+[template rceil[]'''⌉'''] [/ ? right ceiling]
+[template lfloor[]'''⌊'''] [/ ? left floor = APL downstile]
+[template rfloor[]'''⌋'''] [/ ? right floor]
+[template lang[]'''〈'''] [/ < left-pointing angle bracket = bra (Firefox shows ?)]
+[template rang[]'''〉'''] [/ > right-pointing angle bracket = ket (Firefox shows ?)]
+[template loz[]'''◊'''] [/ ? lozenge]
+[template spades[]'''♠'''] [/ ? black spade suit]
+[template clubs[]'''♣'''] [/ ? black club suit = shamrock]
+[template hearts[]'''♥'''] [/ ? black heart suit = valentine]
+[template diams[]'''♦'''] [/ ? black diamond suit]
+[template euro[]'''€'''] [/ ? Euro currency symbol]
+[template lchev[]'''⟨'''] [/ ? left chevron]
+[template rchev[]'''⟩'''] [/ right chevron]
+[template rflat[]'''⟮'''] [/ right flat bracket Misc Math Symbol A]
+[template lflat[]'''⟮'''] [/ left flat bracket]
+[/ U2000.pdf punctuation]
+[template endash[]'''–'''] [/ em width dash]
+[template emdash[]'''—'''] [/ en width dash]
+[template hbar[]'''―'''] [/ ? horizontal bar - introducing quoted text]
+[template vert2bar[]'''‖'''] [/ ? double vertical bar]
+[template line2[]'''‖'''] [/ ? double low line bar]
+[template dagger[]'''†'''] [/ ? dagger]
+[template dagger2[]'''‡'''] [/ ? double dagger]
+[template dot[]'''․'''] [/ dot leader]
+[template dot2[]'''‥'''] [/ ? dots leader]
+[template ellipsis[]'''…'''] [/ horizontal ellipsis]
+
+[template dotover[]'''̇'''] [/ dot over symbol]
+[template recur[]''' ̇'''] [/ math recurring symbol, eg after 0.333]
+[/ Note use of a thin space before digit, so that dot isn't placed directly over the digit.]
+[/ Use:1[recur]]
+
+[/ Other symbols, not in the HTML4 list:]
+[template enquad[] ''' '''] [/ en quad space]
+[template emquad[] ''' '''] [/ em quad space]
+[template enspace[] ''' '''] [/ em half en space]
+[template emspace[] ''' '''] [/ em space type size in points]
+[template thickspace[] ''' '''] [/ 3 per em space]
+[template midspace[] ''' '''] [/ 4 per em space]
+[template sixemspace[] ''' '''] [/ 6 em space]
+[template figspace[] ''' '''] [/ space = width fixed font digit]
+[template punctspace[] ''' '''] [/ space = width punctuation]
+[template thin[] ''' '''] [/ thin space ]
+[template hair[] ''' '''] [/ hair space]
+[template nbsp[] ''' '''] [/ non-breaking space]
+[template space[] ''' '''] [/ plain non-breaking space]
+
+[template nospace[] '''​'''] [/ zero width space]
+[template wordjoin[] '''⁠'''] [/ word joiner - no line break either side]
+[template narrownbsp[] ''' '''] [/ narrow non-breaking space]
+[template hyphen[] '''‐'''] [/ soft hyphen]
+[template nbhyphen[] '''‑'''] [/ non-breaking hyphen]
+
+[template plusminus[]'''±'''] [/ ? plus or minus sign]
+[template sqrt[]'''√'''] [/ ? square root sqrt symbol]
+[/template pow2[]'''⁳'''] [/ 2073 is NOT superscript 2 character]
+[template pow2[]'''²'''] [/ superscript 2 character]
+[template pow3[]'''³'''] [/ superscript 3 character]
+[template pown[]'''ⁿ'''] [/ superscript n character]
+[template frac12[]'''½'''] [/ fraction half]
+[template frac14[]'''¼'''] [/ fraction quarter]
+[template frac34[]'''¾'''] [/ fraction three quarter]
+[template sup1[]'''¹'''] [/ superscript one = superscript digit one ]
+[template sup2[]'''²'''] [/ superscript two = superscript digit two = squared ]
+[template cubed[]'''³'''] [/ superscript three = superscript digit three = cubed ]
+[template macron[]'''¯'''] [/ macron = spacing macron = overline = APL overbar ]
+[template deg[]'''°'''] [/ degree sign ]
+[template plusmn[]'''±'''] [/ plus-minus sign = plus-or-minus sign ]
+[template micro[]'''µ'''] [/ micro sign ]
+[template cedil[]'''¸'''] [/ cedilla = spacing cedilla ]
+[template ordm[]'''º'''] [/ masculine ordinal indicator ]
+[template ordf[]'''ª'''] [/ feminine ordinal indicator ]
+[template laquo[]'''«'''] [/ left-pointing double angle quotation mark = left pointing guillemet ]
+[template raquo[]'''»'''] [/ right-pointing double angle quotation mark = right pointing guillemet ]
+
+[/
+Copyright 2007, 2010 Paul A. Bristow.
+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).
+]
+
Modified: sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk (original)
+++ sandbox/big_number/libs/multiprecision/doc/multiprecision.qbk 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -18,6 +18,7 @@
[/last-revision $Date: 2011-07-08 18:51:46 +0100 (Fri, 08 Jul 2011) $]
]
+[include html4_symbols.qbk]
[import ../example/gmp_snips.cpp]
[import ../example/mpfr_snips.cpp]
[import ../example/cpp_dec_float_snips.cpp]
@@ -34,6 +35,18 @@
[template mpir[] [@http://mpir.org/ MPIR]]
[template tommath[] [@http://libtom.org/?page=features&newsitems=5&whatfile=ltm libtommath]]
+[template super[x]'''<superscript>'''[x]'''</superscript>''']
+[template sub[x]'''<subscript>'''[x]'''</subscript>''']
+
+[template equation[name] '''<inlinemediaobject>
+<imageobject role="html">
+<imagedata fileref="../'''[name]'''.png"></imagedata>
+</imageobject>
+<imageobject role="print">
+<imagedata fileref="../'''[name]'''.svg"></imagedata>
+</imageobject>
+</inlinemediaobject>''']
+
[section:intro Introduction]
@@ -556,14 +569,41 @@
[endsect]
-[section:jel Worked Example: defining a mathematical function.]
+[section:fp_eg Examples]
[import ../example/floating_point_examples.cpp]
+[section:aos Area of Circle]
+
+[AOS1]
+[AOS2]
+[AOS3]
+
+[endsect]
+
+[section:jel Defining a Lambda Function.]
+
[JEL]
[endsect]
+[section:nd Calculating a Derivative]
+
+[ND1]
+[ND2]
+[ND3]
+
+[endsect]
+
+[section:GI Calculating an Integral]
+
+[GI1]
+[GI2]
+
+[endsect]
+
+[endsect]
+
[endsect]
[section:rational Rational Number Types]
@@ -1528,8 +1568,6 @@
[section:backendconc Backend Requirements]
-[template super[x]'''<superscript>'''[x]'''</superscript>''']
-
The requirements on the `Backend` template argument to `mp_number` are split up into
compulsory requirements, and optional requirements that are either to improve performance
or provide optional features.
Modified: sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp (original)
+++ sandbox/big_number/libs/multiprecision/example/floating_point_examples.cpp 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -9,6 +9,48 @@
#include <iostream>
#include <iomanip>
+//[AOS1
+
+/*`Generic numeric programming employs templates to use the same code for different
+floating-point types and functions. Consider the area of a circle a of radius r, given by
+
+[:['a = [pi] * r[super 2]]]
+
+The area of a circle can be computed in generic programming using Boost.Math
+for the constant [pi] as shown below:
+
+*/
+
+//=#include <boost/math/constants/constants.hpp>
+
+template<typename T>
+inline T area_of_a_circle(T r)
+{
+ using boost::math::constants::pi;
+ return pi<T>() * r * r;
+}
+
+/*`
+It is possible to use `area_of_a_circle()` with built-in floating-point types as
+well as floating-point types from Boost.Multiprecision. In particular, consider a
+system with 4-byte single-precision float, 8-byte double-precision double and also the
+`cpp_dec_float_50` data type from Boost.Multiprecision with 50 decimal digits
+of precision.
+
+We can compute and print the approximate area of a circle with radius 123/100 for
+`float`, `double` and `cpp_dec_float_50` with the program below.
+
+*/
+
+//]
+
+//[AOS3
+
+/*`In the next example we'll look at calling both standard library and Boost.Math functions from within generic code.
+We'll also show how to cope with template arguments which are expression-templates rather than number types.*/
+
+//]
+
//[JEL
/*`
@@ -18,7 +60,7 @@
The Jahnke-Emden Lambda function is defined by the equation:
-JahnkeEmden(v, z) = Gamma(v+1) * J[v](z) / (z / 2)^v
+[:['JahnkeEmden(v, z) = [Gamma](v+1) * J[sub v](z) / (z / 2)[super v]]]
If we were to implement this at double precision using Boost.Math's facilities for the Gamma and Bessel
function calls it would look like this:
@@ -166,6 +208,136 @@
//]
+//[ND1
+
+/*`
+In this example we'll add even more power to generic numeric programming using not only different
+floating-point types but also function objects as template parameters. Consider
+some well-known central difference rules for numerically computing the first derivative
+of a function ['f[prime](x)] with ['x [isin] [real]]:
+
+[equation floating_point_eg1]
+
+Where the difference terms ['m[sub n]] are given by:
+
+[equation floating_point_eg2]
+
+and ['dx] is the step-size of the derivative.
+
+The third formula in Equation 1 is a three-point central difference rule. It calculates
+the first derivative of ['f[prime](x)] to ['O(dx[super 6])], where ['dx] is the given step-size.
+For example, if
+the step-size is 0.01 this derivative calculation has about 6 decimal digits of precision -
+just about right for the 7 decimal digits of single-precision float.
+Let's make a generic template subroutine using this three-point central difference
+rule. In particular:
+*/
+
+template<typename value_type, typename function_type>
+ value_type derivative(const value_type x, const value_type dx, function_type func)
+{
+ // Compute d/dx[func(*first)] using a three-point
+ // central difference rule of O(dx^6).
+
+ const value_type dx1 = dx;
+ const value_type dx2 = dx1 * 2;
+ const value_type dx3 = dx1 * 3;
+
+ const value_type m1 = (func(x + dx1) - func(x - dx1)) / 2;
+ const value_type m2 = (func(x + dx2) - func(x - dx2)) / 4;
+ const value_type m3 = (func(x + dx3) - func(x - dx3)) / 6;
+
+ const value_type fifteen_m1 = 15 * m1;
+ const value_type six_m2 = 6 * m2;
+ const value_type ten_dx1 = 10 * dx1;
+
+ return ((fifteen_m1 - six_m2) + m3) / ten_dx1;
+}
+
+/*`The `derivative()` template function can be used to compute the first derivative
+of any function to ['O(dx[super 6])]. For example, consider the first derivative of ['sin(x)] evaluated
+at ['x = [pi]/3]. In other words,
+
+[equation floating_point_eg3]
+
+The code below computes the derivative in Equation 3 for float, double and boost's
+multiple-precision type cpp_dec_float_50.
+*/
+
+//]
+
+//[GI1
+
+/*`
+Similar to the generic derivative example, we can calculate integrals in a similar manner:
+*/
+
+template<typename value_type, typename function_type>
+inline value_type integral(const value_type a,
+ const value_type b,
+ const value_type tol,
+ function_type func)
+{
+ unsigned n = 1U;
+
+ value_type h = (b - a);
+ value_type I = (func(a) + func(b)) * (h / 2);
+
+ for(unsigned k = 0U; k < 8U; k++)
+ {
+ h /= 2;
+
+ value_type sum(0);
+ for(unsigned j = 1U; j <= n; j++)
+ {
+ sum += func(a + (value_type((j * 2) - 1) * h));
+ }
+
+ const value_type I0 = I;
+ I = (I / 2) + (h * sum);
+
+ const value_type ratio = I0 / I;
+ const value_type delta = ratio - 1;
+ const value_type delta_abs = ((delta < 0) ? -delta : delta);
+
+ if((k > 1U) && (delta_abs < tol))
+ {
+ break;
+ }
+
+ n *= 2U;
+ }
+
+ return I;
+}
+
+/*`
+The following sample program shows how the function can be called, we begin
+by defining a function object, which when integrated should yield the Bessel J
+function:
+*/
+
+template<typename value_type>
+class cyl_bessel_j_integral_rep
+{
+public:
+ cyl_bessel_j_integral_rep(const unsigned N,
+ const value_type& X) : n(N), x(X) { }
+
+ value_type operator()(const value_type& t) const
+ {
+ // pi * Jn(x) = Int_0^pi [cos(x * sin(t) - n*t) dt]
+ return cos(x * sin(t) - (n * t));
+ }
+
+private:
+ const unsigned n;
+ const value_type x;
+};
+
+
+//]
+
int main()
{
using namespace boost::multiprecision;
@@ -179,6 +351,197 @@
std::cout << JEL3(cpp_dec_float_50(2.5), cpp_dec_float_50(0.5)) << std::endl;
std::cout << std::scientific << std::setprecision(std::numeric_limits<cpp_dec_float_100>::digits10);
std::cout << JEL4(cpp_dec_float_100(2) + 0.5, cpp_dec_float_100(0.5)) << std::endl;
+
+ //[AOS2
+
+/*=#include <iostream>
+#include <iomanip>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+
+using boost::multiprecision::cpp_dec_float_50;
+
+int main(int, char**)
+{*/
+ const float r_f(float(123) / 100);
+ const float a_f = area_of_a_circle(r_f);
+
+ const double r_d(double(123) / 100);
+ const double a_d = area_of_a_circle(r_d);
+
+ const cpp_dec_float_50 r_mp(cpp_dec_float_50(123) / 100);
+ const cpp_dec_float_50 a_mp = area_of_a_circle(r_mp);
+
+ // 4.75292
+ std::cout
+ << std::setprecision(std::numeric_limits<float>::digits10)
+ << a_f
+ << std::endl;
+
+ // 4.752915525616
+ std::cout
+ << std::setprecision(std::numeric_limits<double>::digits10)
+ << a_d
+ << std::endl;
+
+ // 4.7529155256159981904701331745635599135018975843146
+ std::cout
+ << std::setprecision(std::numeric_limits<cpp_dec_float_50>::digits10)
+ << a_mp
+ << std::endl;
+/*=}*/
+
+ //]
+
+ //[ND2
+/*=
+#include <iostream>
+#include <iomanip>
+#include <boost/multiprecision/cpp_dec_float.hpp>
+#include <boost/math/constants/constants.hpp>
+
+
+int main(int, char**)
+{*/
+ using boost::math::constants::pi;
+ using boost::multiprecision::cpp_dec_float_50;
+ //
+ // We'll pass a function pointer for the function object passed to derivative,
+ // the typecast is needed to select the correct overload of std::sin:
+ //
+ const float d_f = derivative(
+ pi<float>() / 3,
+ 0.01F,
+ static_cast<float(*)(float)>(std::sin)
+ );
+
+ const double d_d = derivative(
+ pi<double>() / 3,
+ 0.001,
+ static_cast<double(*)(double)>(std::sin)
+ );
+ //
+ // In the cpp_dec_float_50 case, the sin function is multiply overloaded
+ // to handle expression templates etc. As a result it's hard to take it's
+ // address without knowing about its implementation details. We'll use a
+ // C++11 lambda expression to capture the call.
+ // We also need a typecast on the first argument so we don't accidently pass
+ // an expression template to a template function:
+ //
+ const cpp_dec_float_50 d_mp = derivative(
+ cpp_dec_float_50(pi<cpp_dec_float_50>() / 3),
+ cpp_dec_float_50(1.0E-9),
+ [](const cpp_dec_float_50& x) -> cpp_dec_float_50
+ {
+ return sin(x);
+ }
+ );
+
+ // 5.000029e-001
+ std::cout
+ << std::setprecision(std::numeric_limits<float>::digits10)
+ << d_f
+ << std::endl;
+
+ // 4.999999999998876e-001
+ std::cout
+ << std::setprecision(std::numeric_limits<double>::digits10)
+ << d_d
+ << std::endl;
+
+ // 4.99999999999999999999999999999999999999999999999999e-01
+ std::cout
+ << std::setprecision(std::numeric_limits<cpp_dec_float_50>::digits10)
+ << d_mp
+ << std::endl;
+//=}
+
+ /*`
+ The expected value of the derivative is 0.5. This central difference rule in this
+ example is ill-conditioned, meaning it suffers from slight loss of precision. With that
+ in mind, the results agree with the expected value of 0.5.*/
+
+ //]
+
+ //[ND3
+
+ /*`
+ We can take this a step further and use our derivative function to compute
+ a partial derivative. For example if we take the incomplete gamma function
+ ['P(a, z)], and take the derivative with respect to /z/ at /(2,2)/ then we
+ can calculate the result as shown below, for good measure we'll compare with
+ the "correct" result obtained from a call to ['gamma_p_derivative], the results
+ agree to approximately 44 digits:
+ */
+
+ cpp_dec_float_50 gd = derivative(
+ cpp_dec_float_50(2),
+ cpp_dec_float_50(1.0E-9),
+ [](const cpp_dec_float_50& x) ->cpp_dec_float_50
+ {
+ return boost::math::gamma_p(2, x);
+ }
+ );
+ // 2.70670566473225383787998989944968806815263091819151e-01
+ std::cout
+ << std::setprecision(std::numeric_limits<cpp_dec_float_50>::digits10)
+ << gd
+ << std::endl;
+ // 2.70670566473225383787998989944968806815253190143120e-01
+ std::cout << boost::math::gamma_p_derivative(cpp_dec_float_50(2), cpp_dec_float_50(2)) << std::endl;
+ //]
+
+ //[GI2
+
+ /* The function can now be called as follows: */
+/*=int main(int, char**)
+{*/
+ using boost::math::constants::pi;
+ typedef boost::multiprecision::cpp_dec_float_50 mp_type;
+
+ const float j2_f =
+ integral(0.0F,
+ pi<float>(),
+ 0.01F,
+ cyl_bessel_j_integral_rep<float>(2U, 1.23F)) / pi<float>();
+
+ const double j2_d =
+ integral(0.0,
+ pi<double>(),
+ 0.0001,
+ cyl_bessel_j_integral_rep<double>(2U, 1.23)) / pi<double>();
+
+ const mp_type j2_mp =
+ integral(mp_type(0),
+ pi<mp_type>(),
+ mp_type(1.0E-20),
+ cyl_bessel_j_integral_rep<mp_type>(2U, mp_type(123) / 100)) / pi<mp_type>();
+
+ // 0.166369
+ std::cout
+ << std::setprecision(std::numeric_limits<float>::digits10)
+ << j2_f
+ << std::endl;
+
+ // 0.166369383786814
+ std::cout
+ << std::setprecision(std::numeric_limits<double>::digits10)
+ << j2_d
+ << std::endl;
+
+ // 0.16636938378681407351267852431513159437103348245333
+ std::cout
+ << std::setprecision(std::numeric_limits<mp_type>::digits10)
+ << j2_mp
+ << std::endl;
+
+ //
+ // Print true value for comparison:
+ // 0.166369383786814073512678524315131594371033482453329
+ std::cout << boost::math::cyl_bessel_j(2, mp_type(123) / 100) << std::endl;
+//=}
+
+ //]
+
return 0;
}
@@ -191,4 +554,12 @@
9.822663964796047e-001
9.82266396479604757017335009796882833995903762577173e-01
9.8226639647960475701733500979688283399590376257717309069410413822165082248153638454147004236848917775e-01
+4.752916e+000
+4.752915525615998e+000
+4.75291552561599819047013317456355991350189758431460e+00
+5.000029e-001
+4.999999999998876e-001
+4.99999999999999999999999999999999999999999999999999e-01
+2.70670566473225383787998989944968806815263091819151e-01
+2.70670566473225383787998989944968806815253190143120e-01
*/
\ No newline at end of file
Modified: sandbox/big_number/libs/multiprecision/example/generic_numerics_examples/generic_numerics_src/generic_integral.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/example/generic_numerics_examples/generic_numerics_src/generic_integral.cpp (original)
+++ sandbox/big_number/libs/multiprecision/example/generic_numerics_examples/generic_numerics_src/generic_integral.cpp 2012-04-09 12:58:30 EDT (Mon, 09 Apr 2012)
@@ -61,44 +61,45 @@
const value_type x;
};
-using boost::math::constants::pi;
-typedef boost::multiprecision::cpp_dec_float_50 mp_type;
int main(int, char**)
{
- const float j2_f =
- integral(0.0F,
- pi<float>(),
- 0.01F,
- cyl_bessel_j_integral_rep<float>(2U, 1.23F)) / pi<float>();
-
- const double j2_d =
- integral(0.0,
- pi<double>(),
- 0.0001,
- cyl_bessel_j_integral_rep<double>(2U, 1.23)) / pi<double>();
-
- const mp_type j2_mp =
- integral(mp_type(0),
- pi<mp_type>(),
- mp_type(1.0E-20),
- cyl_bessel_j_integral_rep<mp_type>(2U, mp_type(123) / 100)) / pi<mp_type>();
-
- // 0.166369
- std::cout
- << std::setprecision(std::numeric_limits<float>::digits10)
- << j2_f
- << std::endl;
-
- // 0.166369383786814
- std::cout
- << std::setprecision(std::numeric_limits<double>::digits10)
- << j2_d
- << std::endl;
-
- // 0.16636938378681407351267852431513159437103348245333
- std::cout
- << std::setprecision(std::numeric_limits<mp_type>::digits10)
- << j2_mp
- << std::endl;
+ using boost::math::constants::pi;
+ typedef boost::multiprecision::cpp_dec_float_50 mp_type;
+
+ const float j2_f =
+ integral(0.0F,
+ pi<float>(),
+ 0.01F,
+ cyl_bessel_j_integral_rep<float>(2U, 1.23F)) / pi<float>();
+
+ const double j2_d =
+ integral(0.0,
+ pi<double>(),
+ 0.0001,
+ cyl_bessel_j_integral_rep<double>(2U, 1.23)) / pi<double>();
+
+ const mp_type j2_mp =
+ integral(mp_type(0),
+ pi<mp_type>(),
+ mp_type(1.0E-20),
+ cyl_bessel_j_integral_rep<mp_type>(2U, mp_type(123) / 100)) / pi<mp_type>();
+
+ // 0.166369
+ std::cout
+ << std::setprecision(std::numeric_limits<float>::digits10)
+ << j2_f
+ << std::endl;
+
+ // 0.166369383786814
+ std::cout
+ << std::setprecision(std::numeric_limits<double>::digits10)
+ << j2_d
+ << std::endl;
+
+ // 0.16636938378681407351267852431513159437103348245333
+ std::cout
+ << std::setprecision(std::numeric_limits<mp_type>::digits10)
+ << j2_mp
+ << std::endl;
}
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