summaryrefslogtreecommitdiff
path: root/boost/libs/math/doc/html/math_toolkit/high_precision
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /boost/libs/math/doc/html/math_toolkit/high_precision
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'boost/libs/math/doc/html/math_toolkit/high_precision')
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/e_float.html68
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/float128.html65
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/use_mpfr.html117
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/use_multiprecision.html364
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/use_ntl.html74
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/using_test.html144
-rw-r--r--boost/libs/math/doc/html/math_toolkit/high_precision/why_high_precision.html139
7 files changed, 971 insertions, 0 deletions
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/e_float.html b/boost/libs/math/doc/html/math_toolkit/high_precision/e_float.html
new file mode 100644
index 00000000..2853c20c
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/e_float.html
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using e_float Library</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="use_mpfr.html" title="Using With MPFR or GMP - High-Precision Floating-Point Library">
+<link rel="next" href="use_ntl.html" title="Using NTL Library">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_mpfr.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_ntl.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.e_float"></a><a class="link" href="e_float.html" title="Using e_float Library">Using e_float Library</a>
+</h3></div></div></div>
+<p>
+ <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
+ was a development from the <a href="http://calgo.acm.org/910.zip" target="_top">e_float
+ (TOMS Algorithm 910)</a> library by Christopher Kormanyos.
+ </p>
+<p>
+ e_float can still be used with Boost.Math library via the header:
+ </p>
+<pre class="programlisting"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">bindings</span><span class="special">/</span><span class="identifier">e_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<p>
+ And the type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">ef</span><span class="special">::</span><span class="identifier">e_float</span></code>:
+ this type is a thin wrapper class around ::e_float which provides the necessary
+ syntactic sugar to make everything "just work".
+ </p>
+<p>
+ There is also a concept checking test program for e_float support <a href="../../../../../../libs/math/test/e_float_concept_check.cpp" target="_top">here</a>.
+ </p>
+<p>
+ <span class="bold"><strong>New projects are recommended to use <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
+ with <code class="computeroutput"><span class="identifier">cpp_float</span></code> backend instead.</strong></span>
+ </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 &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_mpfr.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_ntl.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/float128.html b/boost/libs/math/doc/html/math_toolkit/high_precision/float128.html
new file mode 100644
index 00000000..1c3dbf0b
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/float128.html
@@ -0,0 +1,65 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using with GCC's __float128 datatype</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="use_multiprecision.html" title="Using Boost.Multiprecision">
+<link rel="next" href="use_mpfr.html" title="Using With MPFR or GMP - High-Precision Floating-Point Library">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_multiprecision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_mpfr.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.float128"></a><a class="link" href="float128.html" title="Using with GCC's __float128 datatype">Using with GCC's
+ __float128 datatype</a>
+</h3></div></div></div>
+<p>
+ At present support for GCC's native <code class="computeroutput"><span class="identifier">__float128</span></code>
+ datatype is extremely limited: the numeric constants will all work with that
+ type, and that's about it. If you want to use the distributions or special
+ functions then you will need to provide your own wrapper header that:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ Provides std::numeric_limits&lt;__float128&gt; support.
+ </li>
+<li class="listitem">
+ Provides overloads of the standard library math function for type <code class="computeroutput"><span class="identifier">__float128</span></code>and which forward to the
+ libquadmath equivalents.
+ </li>
+</ul></div>
+<p>
+ Ultimately these facilities should be provided by GCC and <code class="computeroutput"><span class="identifier">libstdc</span><span class="special">++</span></code>.
+ </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 &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_multiprecision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_mpfr.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/use_mpfr.html b/boost/libs/math/doc/html/math_toolkit/high_precision/use_mpfr.html
new file mode 100644
index 00000000..a8482be3
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/use_mpfr.html
@@ -0,0 +1,117 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using With MPFR or GMP - High-Precision Floating-Point Library</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="float128.html" title="Using with GCC's __float128 datatype">
+<link rel="next" href="e_float.html" title="Using e_float Library">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="float128.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="e_float.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.use_mpfr"></a><a class="link" href="use_mpfr.html" title="Using With MPFR or GMP - High-Precision Floating-Point Library">Using With MPFR
+ or GMP - High-Precision Floating-Point Library</a>
+</h3></div></div></div>
+<p>
+ The special functions and tools in this library can be used with <a href="http://www.mpfr.org" target="_top">MPFR</a>
+ (an arbitrary precision number type based on the <a href="http://gmplib.org/" target="_top">GNU
+ Multiple Precision Arithmetic Library</a>), either via the bindings in
+ <a href="../../../../../../boost/math/bindings/mpfr.hpp" target="_top">boost/math/bindings/mpfr.hpp</a>,
+ or via <a href="../../../../../../boost/math/bindings/mpfr.hpp" target="_top">boost/math/bindings/mpreal.hpp</a>.
+ </p>
+<p>
+ <span class="bold"><strong>New projects are recommended to use <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
+ with GMP/MPFR backend instead.</strong></span>
+ </p>
+<p>
+ In order to use these bindings you will need to have installed <a href="http://www.mpfr.org" target="_top">MPFR</a>
+ plus its dependency the <a href="http://gmplib.org" target="_top">GMP library</a>.
+ You will also need one of the two supported C++ wrappers for MPFR: <a href="http://math.berkeley.edu/~wilken/code/gmpfrxx/" target="_top">gmpfrxx (or mpfr_class)</a>,
+ or <a href="http://www.holoborodko.com/pavel/mpfr/" target="_top">mpfr-C++ (mpreal)</a>.
+ </p>
+<p>
+ Unfortunately neither <code class="computeroutput"><span class="identifier">mpfr_class</span></code>
+ nor <code class="computeroutput"><span class="identifier">mpreal</span></code> quite satisfy
+ our conceptual requirements, so there is a very thin set of additional interfaces
+ and some helper traits defined in <a href="../../../../../../boost/math/bindings/mpfr.hpp" target="_top">boost/math/bindings/mpfr.hpp</a>
+ and <a href="../../../../../../boost/math/bindings/mpreal.hpp" target="_top">boost/math/bindings/mpreal.hpp</a>
+ that you should use in place of including 'gmpfrxx.h' or 'mpreal.h' directly.
+ The classes <code class="computeroutput"><span class="identifier">mpfr_class</span></code> or
+ <code class="computeroutput"><span class="identifier">mpreal</span></code> are then usable unchanged
+ once this header is included, so for example <code class="computeroutput"><span class="identifier">mpfr_class</span></code>'s
+ performance-enhancing expression templates are preserved and fully supported
+ by this library:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">bindings</span><span class="special">/</span><span class="identifier">mpfr</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">mpfr_class</span><span class="special">::</span><span class="identifier">set_dprec</span><span class="special">(</span><span class="number">500</span><span class="special">);</span> <span class="comment">// 500 bit precision</span>
+ <span class="comment">//</span>
+ <span class="comment">// Note that the argument to tgamma is</span>
+ <span class="comment">// an expression template - that's just fine here.</span>
+ <span class="comment">//</span>
+ <span class="identifier">mpfr_class</span> <span class="identifier">v</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">tgamma</span><span class="special">(</span><span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">mpfr_class</span><span class="special">(</span><span class="number">2</span><span class="special">)));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">v</span> <span class="special">&lt;&lt;</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>
+ Alternatively use with <code class="computeroutput"><span class="identifier">mpreal</span></code>
+ would look like:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">bindings</span><span class="special">/</span><span class="identifier">mpreal</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">mpfr</span><span class="special">::</span><span class="identifier">mpreal</span><span class="special">::</span><span class="identifier">set_precision</span><span class="special">(</span><span class="number">500</span><span class="special">);</span> <span class="comment">// 500 bit precision</span>
+ <span class="identifier">mpfr</span><span class="special">::</span><span class="identifier">mpreal</span> <span class="identifier">v</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">tgamma</span><span class="special">(</span><span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">mpfr</span><span class="special">::</span><span class="identifier">mpreal</span><span class="special">(</span><span class="number">2</span><span class="special">)));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">v</span> <span class="special">&lt;&lt;</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>
+ For those functions that are based upon the <a class="link" href="../lanczos.html" title="The Lanczos Approximation">Lanczos
+ approximation</a>, the bindings defines a series of approximations with
+ up to 61 terms and accuracy up to approximately 3e-113. This therefore sets
+ the upper limit for accuracy to the majority of functions defined this library
+ when used with either <code class="computeroutput"><span class="identifier">mpfr_class</span></code>
+ or <code class="computeroutput"><span class="identifier">mpreal</span></code>.
+ </p>
+<p>
+ There is a concept checking test program for mpfr support <a href="../../../../../../libs/math/test/mpfr_concept_check.cpp" target="_top">here</a>
+ and <a href="../../../../../../libs/math/test/mpreal_concept_check.cpp" target="_top">here</a>.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="float128.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="e_float.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/use_multiprecision.html b/boost/libs/math/doc/html/math_toolkit/high_precision/use_multiprecision.html
new file mode 100644
index 00000000..db2192df
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/use_multiprecision.html
@@ -0,0 +1,364 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using Boost.Multiprecision</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="why_high_precision.html" title="Why use a high-precision library rather than built-in floating-point types?">
+<link rel="next" href="float128.html" title="Using with GCC's __float128 datatype">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="why_high_precision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="float128.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.use_multiprecision"></a><a class="link" href="use_multiprecision.html" title="Using Boost.Multiprecision">Using
+ Boost.Multiprecision</a>
+</h3></div></div></div>
+<p>
+ <span class="bold"><strong>All new projects are recommended to use <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>.</strong></span>
+ </p>
+<h6>
+<a name="math_toolkit.high_precision.use_multiprecision.h0"></a>
+ <span class="phrase"><a name="math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_cpp_f"></a></span><a class="link" href="use_multiprecision.html#math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_cpp_f">Using
+ Boost.Multiprecision <code class="computeroutput"><span class="identifier">cpp_float</span></code>
+ for numerical calculations with high precision.</a>
+ </h6>
+<p>
+ The Boost.Multiprecision library can be used for computations requiring precision
+ exceeding that of standard built-in types such as float, double and long
+ double. For extended-precision calculations, Boost.Multiprecision supplies
+ a template data type called cpp_dec_float. The number of decimal digits of
+ precision is fixed at compile-time via template parameter.
+ </p>
+<p>
+ To use these floating-point types and constants, we need some includes:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="comment">// using boost::multiprecision::cpp_dec_float</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">limits</span><span class="special">&gt;</span>
+</pre>
+<p>
+ So now we can demonstrate with some trivial calculations:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+</pre>
+<p>
+ Using <code class="computeroutput"><span class="keyword">typedef</span> <span class="identifier">cpp_dec_float_50</span></code>
+ hides the complexity of multiprecision to allow us to define variables with
+ 50 decimal digit precision just like built-in <code class="computeroutput"><span class="keyword">double</span></code>.
+ </p>
+<pre class="programlisting"><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="identifier">cpp_dec_float_50</span> <span class="identifier">seventh</span> <span class="special">=</span> <span class="identifier">cpp_dec_float_50</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">/</span> <span class="number">7</span><span class="special">;</span>
+</pre>
+<p>
+ By default, output would only show the standard 6 decimal digits, so set
+ precision to show all 50 significant digits.
+ </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">precision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;::</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">&lt;&lt;</span> <span class="identifier">seventh</span> <span class="special">&lt;&lt;</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"><span class="number">0.14285714285714285714285714285714285714285714285714</span>
+</pre>
+<p>
+ We can also use constants, guaranteed to be initialized with the very last
+ bit of precision.
+ </p>
+<pre class="programlisting"><span class="identifier">cpp_dec_float_50</span> <span class="identifier">circumference</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">pi</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;()</span> <span class="special">*</span> <span class="number">2</span> <span class="special">*</span> <span class="identifier">seventh</span><span class="special">;</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">circumference</span> <span class="special">&lt;&lt;</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"><span class="number">0.89759790102565521098932668093700082405633411410717</span>
+</pre>
+<h6>
+<a name="math_toolkit.high_precision.use_multiprecision.h1"></a>
+ <span class="phrase"><a name="math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_to_ge"></a></span><a class="link" href="use_multiprecision.html#math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_to_ge">Using
+ Boost.Multiprecision to generate a high-precision array of sin coefficents
+ for use with FFT.</a>
+ </h6>
+<p>
+ The Boost.Multiprecision library can be used for computations requiring precision
+ exceeding that of standard built-in types such as <code class="computeroutput"><span class="keyword">float</span></code>,
+ <code class="computeroutput"><span class="keyword">double</span></code> and <code class="computeroutput"><span class="keyword">long</span>
+ <span class="keyword">double</span></code>. For extended-precision calculations,
+ Boost.Multiprecision supplies a template data type called <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code>.
+ The number of decimal digits of precision is fixed at compile-time via template
+ parameter.
+ </p>
+<p>
+ To use these floating-point types and constants, we need some includes:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="comment">// using boost::math::constants::pi;</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+<span class="comment">// using boost::multiprecision::cpp_dec_float</span>
+
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">limits</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">algorithm</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iomanip</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iterator</span><span class="special">&gt;</span>
+<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">fstream</span><span class="special">&gt;</span>
+</pre>
+<p>
+ Define a text string which is a C++ comment with the program licence, copyright
+ etc. You could of course, tailor this to your needs, including your copyright
+ claim. There are versions of <code class="computeroutput"><span class="identifier">array</span></code>
+ provided by Boost.Array in <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">array</span></code>
+ or the C++11 std::array, but since not all platforms provide C++11 support,
+ this program provides the Boost version as fallback.
+ </p>
+<pre class="programlisting"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">prolog</span> <span class="special">=</span>
+<span class="special">{</span>
+ <span class="string">"// Use, modification and distribution are subject to the\n"</span>
+ <span class="string">"// Boost Software License, Version 1.0.\n"</span>
+ <span class="string">"// (See accompanying file LICENSE_1_0.txt\n"</span>
+ <span class="string">"// or copy at "</span><span class="string">"http://www.boost.org/LICENSE_1_0.txt)\n\n"</span>
+
+ <span class="string">"// Copyright ???? 2013.\n\n"</span>
+
+ <span class="string">"// Use boost/array if std::array (C++11 feature) is not available.\n"</span>
+ <span class="string">"#ifdef BOOST_NO_CXX11_HDR_ARRAY\n"</span>
+ <span class="string">"#include &lt;boost/array/array.hpp&gt;\n"</span>
+ <span class="string">"#else\n"</span>
+ <span class="string">"#include &lt;array&gt;\n"</span>
+ <span class="string">"#endif\n\n"</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">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="comment">// VS 2010 (wrongly) requires these at file scope, not local scope in `main`.</span>
+<span class="comment">// This program also requires `-std=c++11` option to compile using Clang and GCC.</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+</pre>
+<p>
+ One often needs to compute tables of numbers in mathematical software.
+ </p>
+<p>
+ A fast Fourier transform (FFT), for example, may use a table of the values
+ of sin((&#960;/2<sup>n</sup>) in its implementation details. In order to maximize the precision
+ in the FFT implementation, the precision of the tabulated trigonometric values
+ should exceed that of the built-in floating-point type used in the FFT.
+ </p>
+<p>
+ The sample below computes a table of the values of sin(&#960;/2<sup>n</sup>) in the range
+ 1 &lt;= n &lt;= 31.
+ </p>
+<p>
+ This program makes use of, among other program elements, the data type <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span></code> for a precision of 50
+ decimal digits from Boost.Multiprecision, the value of constant &#960; retrieved
+ from Boost.Math, guaranteed to be initialized with the very last bit of precision
+ for the type, here <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>,
+ and a C++11 lambda function combined with <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">()</span></code>.
+ </p>
+<p>
+ define the number of values in the array.
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="number">32U</span><span class="special">;</span>
+<span class="identifier">cpp_dec_float_50</span> <span class="identifier">p</span> <span class="special">=</span> <span class="identifier">pi</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;();</span>
+<span class="identifier">cpp_dec_float_50</span> <span class="identifier">p2</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">pi</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;();</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span> <span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;</span> <span class="identifier">sin_values</span> <span class="special">(</span><span class="identifier">size</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="comment">// Generate the sine values.</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span>
+<span class="special">(</span>
+ <span class="identifier">sin_values</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span>
+ <span class="identifier">sin_values</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span>
+ <span class="special">[&amp;</span><span class="identifier">n</span><span class="special">](</span><span class="identifier">cpp_dec_float_50</span><span class="special">&amp;</span> <span class="identifier">y</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">sin</span><span class="special">(</span> <span class="identifier">pi</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;()</span> <span class="special">/</span> <span class="identifier">pow</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">n</span><span class="special">));</span>
+ <span class="special">++</span><span class="identifier">n</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">);</span>
+</pre>
+<p>
+ Define the floating-point type for the generated file, either built-in <code class="computeroutput"><span class="keyword">double</span><span class="special">,</span> </code>float,
+ or <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>,
+ or a user defined type like <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>.
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">fp_type</span> <span class="special">=</span> <span class="string">"double"</span><span class="special">;</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Generating an `std::array` or `boost::array` for floating-point type: "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">fp_type</span> <span class="special">&lt;&lt;</span> <span class="string">". "</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ By default, output would only show the standard 6 decimal digits, so set
+ precision to show enough significant digits for the chosen floating-point
+ type. For <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>
+ is 50. (50 decimal digits should be ample for most applications).
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">streamsize</span> <span class="identifier">precision</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50</span><span class="special">&gt;::</span><span class="identifier">digits10</span><span class="special">;</span>
+
+<span class="comment">// std::cout.precision(std::numeric_limits&lt;cpp_dec_float_50&gt;::digits10);</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">precision</span> <span class="special">&lt;&lt;</span> <span class="string">" decimal digits precision. "</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</pre>
+<p>
+ Of course, one could also choose less, for example, 36 would be sufficient
+ for the most precise current <code class="computeroutput"><span class="keyword">long</span>
+ <span class="keyword">double</span></code> implementations using 128-bit.
+ In general, it should be a couple of decimal digits more (guard digits) than
+ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">max_digits10</span></code> for the target system floating-point
+ type. If the implementation does not provide <code class="computeroutput"><span class="identifier">max_digits10</span></code>,
+ the the Kahan formula <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">RealType</span><span class="special">&gt;::</span><span class="identifier">digits</span>
+ <span class="special">*</span> <span class="number">3010</span><span class="special">/</span><span class="number">10000</span> <span class="special">+</span>
+ <span class="number">2</span></code> can be used instead.
+ </p>
+<p>
+ The compiler will read these values as decimal digits strings and use the
+ nearest representation for the floating-point type.
+ </p>
+<p>
+ Now output all the sine table, to a file of your chosen name.
+ </p>
+<pre class="programlisting"> <span class="keyword">const</span> <span class="keyword">char</span> <span class="identifier">sines_name</span><span class="special">[]</span> <span class="special">=</span> <span class="string">"sines.hpp"</span><span class="special">;</span> <span class="comment">// In same directory as .exe</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ofstream</span> <span class="identifier">fout</span><span class="special">(</span><span class="identifier">sines_name</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ios_base</span><span class="special">::</span><span class="identifier">out</span><span class="special">);</span> <span class="comment">// Creates if no file exists,</span>
+ <span class="comment">// &amp; uses default overwrite/ ios::replace.</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">fout</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span> <span class="special">==</span> <span class="keyword">false</span><span class="special">)</span>
+ <span class="special">{</span> <span class="comment">// failed to open OK!</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Open file "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sines_name</span> <span class="special">&lt;&lt;</span> <span class="string">" failed!"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="identifier">EXIT_FAILURE</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">else</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Open file "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sines_name</span> <span class="special">&lt;&lt;</span> <span class="string">" for output OK."</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">fout</span> <span class="special">&lt;&lt;</span> <span class="identifier">prolog</span> <span class="special">&lt;&lt;</span> <span class="string">"// Table of "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sin_values</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">" values with "</span>
+ <span class="special">&lt;&lt;</span> <span class="identifier">precision</span> <span class="special">&lt;&lt;</span> <span class="string">" decimal digits precision,\n"</span>
+ <span class="string">"// generated by program fft_sines_table.cpp.\n"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">fout</span> <span class="special">&lt;&lt;</span>
+<span class="string">"#ifdef BOOST_NO_CXX11_HDR_ARRAY"</span><span class="string">"\n"</span>
+ <span class="string">" static const boost::array&lt;double, "</span> <span class="special">&lt;&lt;</span> <span class="identifier">size</span> <span class="special">&lt;&lt;</span> <span class="string">"&gt; sines =\n"</span>
+<span class="string">"#else"</span><span class="string">"\n"</span>
+<span class="string">" static const std::array&lt;double, "</span> <span class="special">&lt;&lt;</span> <span class="identifier">size</span> <span class="special">&lt;&lt;</span> <span class="string">"&gt; sines =\n"</span>
+<span class="string">"#endif"</span><span class="string">"\n"</span>
+ <span class="string">"{{\n"</span><span class="special">;</span> <span class="comment">// 2nd { needed for some GCC compiler versions.</span>
+ <span class="identifier">fout</span><span class="special">.</span><span class="identifier">precision</span><span class="special">(</span><span class="identifier">precision</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0U</span><span class="special">;</span> <span class="special">;)</span>
+ <span class="special">{</span>
+ <span class="identifier">fout</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sin_values</span><span class="special">[</span><span class="identifier">i</span><span class="special">];</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">i</span> <span class="special">==</span> <span class="identifier">sin_values</span><span class="special">.</span><span class="identifier">size</span><span class="special">()-</span><span class="number">1</span><span class="special">)</span>
+ <span class="special">{</span> <span class="comment">// next is last value.</span>
+ <span class="identifier">fout</span> <span class="special">&lt;&lt;</span> <span class="string">"\n}};\n"</span><span class="special">;</span> <span class="comment">// 2nd } needed for some earlier GCC compiler versions.</span>
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="keyword">else</span>
+ <span class="special">{</span>
+ <span class="identifier">fout</span> <span class="special">&lt;&lt;</span> <span class="string">",\n"</span><span class="special">;</span>
+ <span class="identifier">i</span><span class="special">++;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+
+ <span class="identifier">fout</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Close file "</span> <span class="special">&lt;&lt;</span> <span class="identifier">sines_name</span> <span class="special">&lt;&lt;</span> <span class="string">" for output OK."</span> <span class="special">&lt;&lt;</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>
+ The output file generated can be seen at <a href="../../../../example/sines.hpp" target="_top">../../example/sines.hpp</a>
+ </p>
+<p>
+ The table output is:
+ </p>
+<pre class="programlisting"><span class="identifier">The</span> <span class="identifier">printed</span> <span class="identifier">table</span> <span class="identifier">is</span><span class="special">:</span>
+
+ <span class="number">1</span>
+ <span class="number">0.70710678118654752440084436210484903928483593768847</span>
+ <span class="number">0.38268343236508977172845998403039886676134456248563</span>
+ <span class="number">0.19509032201612826784828486847702224092769161775195</span>
+ <span class="number">0.098017140329560601994195563888641845861136673167501</span>
+ <span class="number">0.049067674327418014254954976942682658314745363025753</span>
+ <span class="number">0.024541228522912288031734529459282925065466119239451</span>
+ <span class="number">0.012271538285719926079408261951003212140372319591769</span>
+ <span class="number">0.0061358846491544753596402345903725809170578863173913</span>
+ <span class="number">0.003067956762965976270145365490919842518944610213452</span>
+ <span class="number">0.0015339801862847656123036971502640790799548645752374</span>
+ <span class="number">0.00076699031874270452693856835794857664314091945206328</span>
+ <span class="number">0.00038349518757139558907246168118138126339502603496474</span>
+ <span class="number">0.00019174759731070330743990956198900093346887403385916</span>
+ <span class="number">9.5873799095977345870517210976476351187065612851145e-05</span>
+ <span class="number">4.7936899603066884549003990494658872746866687685767e-05</span>
+ <span class="number">2.3968449808418218729186577165021820094761474895673e-05</span>
+ <span class="number">1.1984224905069706421521561596988984804731977538387e-05</span>
+ <span class="number">5.9921124526424278428797118088908617299871778780951e-06</span>
+ <span class="number">2.9960562263346607504548128083570598118251878683408e-06</span>
+ <span class="number">1.4980281131690112288542788461553611206917585861527e-06</span>
+ <span class="number">7.4901405658471572113049856673065563715595930217207e-07</span>
+ <span class="number">3.7450702829238412390316917908463317739740476297248e-07</span>
+ <span class="number">1.8725351414619534486882457659356361712045272098287e-07</span>
+ <span class="number">9.3626757073098082799067286680885620193236507169473e-08</span>
+ <span class="number">4.681337853654909269511551813854009695950362701667e-08</span>
+ <span class="number">2.3406689268274552759505493419034844037886207223779e-08</span>
+ <span class="number">1.1703344634137277181246213503238103798093456639976e-08</span>
+ <span class="number">5.8516723170686386908097901008341396943900085051757e-09</span>
+ <span class="number">2.9258361585343193579282304690689559020175857150074e-09</span>
+ <span class="number">1.4629180792671596805295321618659637103742615227834e-09</span>
+<span class="special">*/</span>
+</pre>
+<p>
+ The output can be copied as text and readily integrated into a given source
+ code. Alternatively, the output can be written to a text or even be used
+ within a self-written automatic code generator as this example.
+ </p>
+<p>
+ A computer algebra system can be used to verify the results obtained from
+ Boost.Math and Boost.Multiprecision. For example, the <a href="http://www.wolfram.com/products/mathematica/index.html" target="_top">Wolfram
+ Mathematica</a> computer algebra system can obtain a similar table with
+ the command:
+ </p>
+<pre class="programlisting"><span class="identifier">Table</span><span class="special">[</span><span class="identifier">N</span><span class="special">[</span><span class="identifier">Sin</span><span class="special">[</span><span class="identifier">Pi</span> <span class="special">/</span> <span class="special">(</span><span class="number">2</span><span class="special">^</span><span class="identifier">n</span><span class="special">)],</span> <span class="number">50</span><span class="special">],</span> <span class="special">{</span><span class="identifier">n</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="number">31</span><span class="special">,</span> <span class="number">1</span><span class="special">}]</span>
+</pre>
+<p>
+ The <a href="http://www.wolframalpha.com/" target="_top">Wolfram Alpha</a> computational
+ knowledge engine can also be used to generate this table. The same command
+ can be pasted into the compute box.
+ </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 &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="why_high_precision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="float128.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/use_ntl.html b/boost/libs/math/doc/html/math_toolkit/high_precision/use_ntl.html
new file mode 100644
index 00000000..4c645152
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/use_ntl.html
@@ -0,0 +1,74 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using NTL Library</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="e_float.html" title="Using e_float Library">
+<link rel="next" href="using_test.html" title="Using without expression templates for Boost.Test and others">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="e_float.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="using_test.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.use_ntl"></a><a class="link" href="use_ntl.html" title="Using NTL Library">Using NTL Library</a>
+</h3></div></div></div>
+<p>
+ <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL::RR</a> (an arbitrarily-fixed
+ precision floating-point number type), can be used via the bindings in <a href="../../../../../../boost/math/bindings/rr.hpp" target="_top">boost/math/bindings/rr.hpp</a>.
+ For details, see <a href="http://shoup.net/ntl/" target="_top">NTL: A Library for doing
+ Number Theory by Victor Shoup</a>.
+ </p>
+<p>
+ <span class="bold"><strong>New projects are recommended to use <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
+ instead.</strong></span>
+ </p>
+<p>
+ Unfortunately <code class="computeroutput"><span class="identifier">NTL</span><span class="special">::</span><span class="identifier">RR</span></code> doesn't quite satisfy our conceptual
+ requirements, so there is a very thin wrapper class <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">ntl</span><span class="special">::</span><span class="identifier">RR</span></code> defined in <a href="../../../../../../boost/math/bindings/rr.hpp" target="_top">boost/math/bindings/rr.hpp</a>
+ that you should use in place of <code class="computeroutput"><span class="identifier">NTL</span><span class="special">::</span><span class="identifier">RR</span></code>. The
+ class is intended to be a drop-in replacement for the "real" NTL::RR
+ that adds some syntactic sugar to keep this library happy, plus some of the
+ standard library functions not implemented in NTL.
+ </p>
+<p>
+ For those functions that are based upon the <a class="link" href="../lanczos.html" title="The Lanczos Approximation">Lanczos
+ approximation</a>, the bindings defines a series of approximations with
+ up to 61 terms and accuracy up to approximately 3e-113. This therefore sets
+ the upper limit for accuracy to the majority of functions defined this library
+ when used with <code class="computeroutput"><span class="identifier">NTL</span><span class="special">::</span><span class="identifier">RR</span></code>.
+ </p>
+<p>
+ There is a concept checking test program for NTL support <a href="../../../../../../libs/math/test/ntl_concept_check.cpp" target="_top">here</a>.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="e_float.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="using_test.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/using_test.html b/boost/libs/math/doc/html/math_toolkit/high_precision/using_test.html
new file mode 100644
index 00000000..d5b886cf
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/using_test.html
@@ -0,0 +1,144 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Using without expression templates for Boost.Test and others</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="use_ntl.html" title="Using NTL Library">
+<link rel="next" href="../real_concepts.html" title="Conceptual Requirements for Real Number Types">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_ntl.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../real_concepts.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.using_test"></a><a class="link" href="using_test.html" title="Using without expression templates for Boost.Test and others">Using without
+ expression templates for Boost.Test and others</a>
+</h3></div></div></div>
+<p>
+ As noted in the <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
+ documentation, certain program constructs will not compile when using expression
+ templates. One example that many users may encounter is Boost.Test (1.54
+ and earlier) when using macro BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION.
+ </p>
+<p>
+ If, for example, you wish to use any multiprecision type like <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code> in place of <code class="computeroutput"><span class="keyword">double</span></code> to give more precision, you will need
+ to override the default <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">et_on</span></code>
+ with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">et_off</span></code>.
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span>
+</pre>
+<p>
+ To define a 50 decimal digit type using <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code>,
+ you must pass two template parameters 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">number</span></code>.
+ </p>
+<p>
+ It may be more legible to use a two-staged type definition such as this:
+ </p>
+<pre class="programlisting"><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</span><span class="special">&lt;</span><span class="number">50</span><span class="special">&gt;</span> <span class="identifier">mp_backend</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">number</span><span class="special">&lt;</span><span class="identifier">mp_backend</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">et_off</span><span class="special">&gt;</span> <span class="identifier">cpp_dec_float_50_noet</span><span class="special">;</span>
+</pre>
+<p>
+ Here, we first define <code class="computeroutput"><span class="identifier">mp_backend</span></code>
+ as <code class="computeroutput"><span class="identifier">cpp_dec_float</span></code> with 50
+ digits. The second step passes this backend 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">number</span></code>
+ with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">et_off</span></code>, an enumerated type.
+ </p>
+<pre class="programlisting"><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">number</span><span class="special">&lt;</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">&lt;</span><span class="number">50</span><span class="special">&gt;,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">et_off</span><span class="special">&gt;</span>
+<span class="identifier">cpp_dec_float_50_noet</span><span class="special">;</span>
+</pre>
+<p>
+ You can reduce typing with a <code class="computeroutput"><span class="keyword">using</span></code>
+ directive <code class="computeroutput"><span class="keyword">using</span> <span class="keyword">namespace</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span></code>
+ if desired, as shown below.
+ </p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span>
+</pre>
+<p>
+ Now <code class="computeroutput"><span class="identifier">cpp_dec_float_50_noet</span></code>
+ or <code class="computeroutput"><span class="identifier">cpp_dec_float_50_et</span></code> can
+ be used as a direct replacement for built-in types like <code class="computeroutput"><span class="keyword">double</span></code>
+ etc.
+ </p>
+<pre class="programlisting"><span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">cpp_float_test_check_close_noet</span><span class="special">)</span>
+<span class="special">{</span> <span class="comment">// No expression templates/</span>
+ <span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float</span><span class="special">&lt;</span><span class="number">50</span><span class="special">&gt;,</span> <span class="identifier">et_off</span><span class="special">&gt;</span> <span class="identifier">cpp_dec_float_50_noet</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">precision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_noet</span><span class="special">&gt;::</span><span class="identifier">digits10</span><span class="special">);</span> <span class="comment">// All significant digits.</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showpoint</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// Show trailing zeros.</span>
+
+ <span class="identifier">cpp_dec_float_50_noet</span> <span class="identifier">a</span> <span class="special">(</span><span class="string">"1.0"</span><span class="special">);</span>
+ <span class="identifier">cpp_dec_float_50_noet</span> <span class="identifier">b</span> <span class="special">(</span><span class="string">"1.0"</span><span class="special">);</span>
+ <span class="identifier">b</span> <span class="special">+=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_noet</span><span class="special">&gt;::</span><span class="identifier">epsilon</span><span class="special">();</span> <span class="comment">// Increment least significant decimal digit.</span>
+
+ <span class="identifier">cpp_dec_float_50_noet</span> <span class="identifier">eps</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_noet</span><span class="special">&gt;::</span><span class="identifier">epsilon</span><span class="special">();</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span><span class="string">"a = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">a</span> <span class="special">&lt;&lt;</span> <span class="string">",\nb = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">b</span> <span class="special">&lt;&lt;</span> <span class="string">",\neps = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">eps</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">BOOST_CHECK_CLOSE</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span> <span class="special">*</span> <span class="number">100</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as percent).</span>
+ <span class="identifier">BOOST_CHECK_CLOSE_FRACTION</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as fraction).</span>
+
+
+
+<span class="special">}</span> <span class="comment">// BOOST_AUTO_TEST_CASE(cpp_float_test_check_close)</span>
+
+<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span><span class="identifier">cpp_float_test_check_close_et</span><span class="special">)</span>
+<span class="special">{</span> <span class="comment">// Using expression templates.</span>
+ <span class="keyword">typedef</span> <span class="identifier">number</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float</span><span class="special">&lt;</span><span class="number">50</span><span class="special">&gt;,</span> <span class="identifier">et_on</span><span class="special">&gt;</span> <span class="identifier">cpp_dec_float_50_et</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">precision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_et</span><span class="special">&gt;::</span><span class="identifier">digits10</span><span class="special">);</span> <span class="comment">// All significant digits.</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showpoint</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// Show trailing zeros.</span>
+
+ <span class="identifier">cpp_dec_float_50_et</span> <span class="identifier">a</span><span class="special">(</span><span class="string">"1.0"</span><span class="special">);</span>
+ <span class="identifier">cpp_dec_float_50_et</span> <span class="identifier">b</span><span class="special">(</span><span class="string">"1.0"</span><span class="special">);</span>
+ <span class="identifier">b</span> <span class="special">+=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_et</span><span class="special">&gt;::</span><span class="identifier">epsilon</span><span class="special">();</span> <span class="comment">// Increment least significant decimal digit.</span>
+
+ <span class="identifier">cpp_dec_float_50_et</span> <span class="identifier">eps</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">cpp_dec_float_50_et</span><span class="special">&gt;::</span><span class="identifier">epsilon</span><span class="special">();</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"a = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">a</span> <span class="special">&lt;&lt;</span> <span class="string">",\nb = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">b</span> <span class="special">&lt;&lt;</span> <span class="string">",\neps = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">eps</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="identifier">BOOST_CHECK_CLOSE</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span> <span class="special">*</span> <span class="number">100</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as percent).</span>
+ <span class="identifier">BOOST_CHECK_CLOSE_FRACTION</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as fraction).</span>
+</pre>
+<p>
+ Using <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code> with
+ the default expression template use switched on, the compiler error message
+ for `BOOST_CHECK_CLOSE_FRACTION(a, b, eps); would be:
+ </p>
+<pre class="programlisting"><span class="comment">// failure floating_point_comparison.hpp(59): error C2440: 'static_cast' :</span>
+<span class="comment">// cannot convert from 'int' to 'boost::multiprecision::detail::expression&lt;tag,Arg1,Arg2,Arg3,Arg4&gt;'</span>
+</pre>
+<p>
+ A full example code is at <a href="../../../../example/test_cpp_float_close_fraction.cpp" target="_top">test_cpp_float_close_fraction.cpp</a>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="use_ntl.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../real_concepts.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/boost/libs/math/doc/html/math_toolkit/high_precision/why_high_precision.html b/boost/libs/math/doc/html/math_toolkit/high_precision/why_high_precision.html
new file mode 100644
index 00000000..5ff2b0dc
--- /dev/null
+++ b/boost/libs/math/doc/html/math_toolkit/high_precision/why_high_precision.html
@@ -0,0 +1,139 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Why use a high-precision library rather than built-in floating-point types?</title>
+<link rel="stylesheet" href="../../math.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
+<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
+<link rel="up" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="prev" href="../high_precision.html" title="Using Boost.Math with High-Precision Floating-Point Libraries">
+<link rel="next" href="use_multiprecision.html" title="Using Boost.Multiprecision">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../high_precision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_multiprecision.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="math_toolkit.high_precision.why_high_precision"></a><a class="link" href="why_high_precision.html" title="Why use a high-precision library rather than built-in floating-point types?">Why use
+ a high-precision library rather than built-in floating-point types?</a>
+</h3></div></div></div>
+<p>
+ For nearly all applications, the built-in floating-point types, <code class="computeroutput"><span class="keyword">double</span></code> (and <code class="computeroutput"><span class="keyword">long</span>
+ <span class="keyword">double</span></code> if this offers higher precision
+ than <code class="computeroutput"><span class="keyword">double</span></code>) offer enough precision,
+ typically a dozen decimal digits.
+ </p>
+<p>
+ Some reasons why one would want to use a higher precision:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ A much more precise result (many more digits) is just a requirement.
+ </li>
+<li class="listitem">
+ The range of the computed value exceeds the range of the type: factorials
+ are the textbook example.
+ </li>
+<li class="listitem">
+ Using <code class="computeroutput"><span class="keyword">double</span></code> is (or may
+ be) too inaccurate.
+ </li>
+<li class="listitem">
+ Using <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>
+ (or may be) is too inaccurate.
+ </li>
+<li class="listitem">
+ Using an extended-precision type implemented in software as <a href="http://en.wikipedia.org/wiki/Double-double_(arithmetic)#Double-double_arithmetic" target="_top">double-double</a>
+ (<a href="http://en.wikipedia.org/wiki/Darwin_(operating_system)" target="_top">Darwin</a>)
+ is sometimes unpredictably inaccurate.
+ </li>
+<li class="listitem">
+ Loss of precision or inaccuracy caused by extreme arguments or cancellation
+ error.
+ </li>
+<li class="listitem">
+ An accuracy as good as possible for a chosen built-in floating-point
+ type is required.
+ </li>
+<li class="listitem">
+ As a reference value, for example, to determine the inaccuracy of a value
+ computed with a built-in floating point type, (perhaps even using some
+ quick'n'dirty algorithm). The accuracy of many functions and distributions
+ in Boost.Math has been measured in this way from tables of very high
+ precision (up to 1000 decimal digits).
+ </li>
+</ul></div>
+<p>
+ Many functions and distributions have differences from exact values that
+ are only a few least significant bits - computation noise. Others, often
+ those for which analytical solutions are not available, require approximations
+ and iteration: these may lose several decimal digits of precision.
+ </p>
+<p>
+ Much larger loss of precision can occur for <a href="http://en.wikipedia.org/wiki/Boundary_case" target="_top">boundary</a>
+ or <a href="http://en.wikipedia.org/wiki/Corner_case" target="_top">corner cases</a>,
+ often caused by <a href="http://en.wikipedia.org/wiki/Loss_of_significance" target="_top">cancellation
+ errors</a>.
+ </p>
+<p>
+ (Some of the worst and most common examples of <a href="http://en.wikipedia.org/wiki/Loss_of_significance" target="_top">cancellation
+ error or loss of significance</a> can be avoided by using <a class="link" href="../stat_tut/overview/complements.html" title="Complements are supported too - and when to use them">complements</a>:
+ see <a class="link" href="../stat_tut/overview/complements.html#why_complements">why complements?</a>).
+ </p>
+<p>
+ If you require a value which is as accurate as can be represented in the
+ floating-point type, and is thus the closest representable value and has
+ an error less than 1/2 a <a href="http://en.wikipedia.org/wiki/Least_significant_bit" target="_top">least
+ significant bit</a> or <a href="http://en.wikipedia.org/wiki/Unit_in_the_last_place" target="_top">ulp</a>
+ it may be useful to use a higher-precision type, for example, <code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code>, to generate this value.
+ Conversion of this value to a built-in floating-point type ('float', <code class="computeroutput"><span class="keyword">double</span></code> or <code class="computeroutput"><span class="keyword">long</span>
+ <span class="keyword">double</span></code>) will not cause any further
+ loss of precision. A decimal digit string will also be 'read' precisely by
+ the compiler into a built-in floating-point type to the nearest representable
+ value.
+ </p>
+<div class="note"><table border="0" summary="Note">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
+<th align="left">Note</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ In contrast, reading a value from an <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">istream</span></code>
+ into a built-in floating-point type is <span class="bold"><strong>not guaranteed
+ by the C++ Standard</strong></span> to give the nearest representable value.
+ </p></td></tr>
+</table></div>
+<p>
+ William Kahan coined the term <a href="http://en.wikipedia.org/wiki/Rounding#The_table-maker.27s_dilemma" target="_top">Table-Maker's
+ Dilemma</a> for the problem of correctly rounding functions. Using a
+ much higher precision (50 or 100 decimal digits) is a practical way of generating
+ (almost always) correctly rounded values.
+ </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 &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
+ Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
+ Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
+ Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../high_precision.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../high_precision.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="use_multiprecision.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>