2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-26 06:42:12 +00:00

Merge branch 'develop'

This commit is contained in:
jzmaddock
2016-08-16 12:12:54 +01:00
17 changed files with 65 additions and 192 deletions

View File

@@ -6,7 +6,8 @@
[import ../../example/cstdfloat_example.cpp]
[import ../../example/normal_tables.cpp]
[import ../../example/quadmath_snprintf.c]
[/Removed as unhelpful for C++ users, but might have use as a check that quadmath is available and linked OK.]
[/import ../../example/quadmath_snprintf.c]
[section:specified_typedefs Overview]
@@ -39,6 +40,16 @@ and may not be supplied for all platforms/compilers, because compiler
support for a 128-bit floating-point type is not mandated by either
the C standard or the C++ standard.
If 128-bit floating-point is supported, then including `boost/cstdfloat.hpp`
provides a [*native] 128-bit type, and
includes other headers in folder `boost/math/cstdfloat` that provide C++
quad support for __C_math in `<cmath>`, `<limits>`, `<iostream>`, `<complex>`,
and the available floating-point types.
One can also, more robustly, include `boost/multiprecision/float128.hpp`
and this provides a thin wrapper selecting the appropriate 128-bit native type
from `cstdfloat` if available, or else a 128-bit multiprecision type.
See [link math_toolkit.examples.je_lambda Jahnke-Emden-Lambda function example]
for an example using both a `<cmath>` function and a Boost.Math function
to evaluate a moderately interesting function, the
@@ -83,7 +94,7 @@ naming conventions.
a `typedef` if the underlying type is not provided by the compiler].
For example, if a compiler does not have an underlying floating-point
type with 128 bits (highly sought-after in scientific and numeric programming),
then `float128_t` and its corresponding least and fast types are not
then `float128_t` and its corresponding least and fast types are [*not]
provided by `<boost/cstdfloat.hpp`>.]
[warning If `<boost/cstdfloat.hpp>` uses a compiler-specific non-standardized type
@@ -335,16 +346,17 @@ Some sample output for two different platforms is appended to the code at
[section:float128_hints Hints on using float128 (and __float128)]
[h5:different_float128 __float128 versus float128]
* __float128 is the compiler supplied hardware type,
* __float128 is the (optionally) compiler supplied hardware type,
it's an C-ish extension to C++ and there is only
minimal support for it in normal C++
(no IO streams or `numeric_limits` support,
function names in libquadmath all have different names to the
`std::` ones etc.)
So you can program that type directly but it's harder work.
So you can program type `__float128` directly, but it's harder work.
* Type float128 is a thin wrapper around __float128 and makes it
C++ and generic code friendly.
* Type `float128` uses __float128 and makes it C++ and generic code friendly,
with all the usual standard `iostream`, `numeric_limits`, `complex` in namspace `std::` available,
so strongly recommended for C++ use.
[h5 Hints and tips]
@@ -364,7 +376,8 @@ and not
Boost.Math is probably less error prone than declaring your own,
likewise the special functions etc.
Some examples of what can go horribly and silently wrong are at [@../../example/float128_example.cpp float128_example.cpp].
Some examples of what can go horribly and silently wrong are at
[@../../example/float128_example.cpp float128_example.cpp].
[endsect] [/section:float128_hints Hints on using float128]

View File

@@ -116,7 +116,7 @@ This manual is also available in <a href="http://sourceforge.net/projects/boost/
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: August 09, 2016 at 14:52:49 GMT</small></p></td>
<td align="left"><p><small>Last revised: August 12, 2016 at 15:17:43 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1822442"></a>Function Index</h2></div></div></div>
<a name="id1827378"></a>Function Index</h2></div></div></div>
<p><a class="link" href="s01.html#idx_id_0">2</a> <a class="link" href="s01.html#idx_id_1">4</a> <a class="link" href="s01.html#idx_id_2">A</a> <a class="link" href="s01.html#idx_id_3">B</a> <a class="link" href="s01.html#idx_id_4">C</a> <a class="link" href="s01.html#idx_id_5">D</a> <a class="link" href="s01.html#idx_id_6">E</a> <a class="link" href="s01.html#idx_id_7">F</a> <a class="link" href="s01.html#idx_id_8">G</a> <a class="link" href="s01.html#idx_id_9">H</a> <a class="link" href="s01.html#idx_id_10">I</a> <a class="link" href="s01.html#idx_id_11">J</a> <a class="link" href="s01.html#idx_id_12">K</a> <a class="link" href="s01.html#idx_id_13">L</a> <a class="link" href="s01.html#idx_id_14">M</a> <a class="link" href="s01.html#idx_id_15">N</a> <a class="link" href="s01.html#idx_id_16">O</a> <a class="link" href="s01.html#idx_id_17">P</a> <a class="link" href="s01.html#idx_id_18">Q</a> <a class="link" href="s01.html#idx_id_19">R</a> <a class="link" href="s01.html#idx_id_20">S</a> <a class="link" href="s01.html#idx_id_21">T</a> <a class="link" href="s01.html#idx_id_22">U</a> <a class="link" href="s01.html#idx_id_23">V</a> <a class="link" href="s01.html#idx_id_25">X</a> <a class="link" href="s01.html#idx_id_26">Y</a> <a class="link" href="s01.html#idx_id_27">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -2255,10 +2255,6 @@
</dt>
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">quadmath_snprintf</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">Implementation of Float128 type</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">quantile</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/stat_tut/overview/complements.html" title="Complements are supported too - and when to use them"><span class="index-entry-level-1">Complements are supported too - and when to use them</span></a></p></li>
@@ -2667,10 +2663,6 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">strtoflt128</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">Implementation of Float128 type</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">subtraction</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/sf_gamma/digamma.html" title="Digamma"><span class="index-entry-level-1">Digamma</span></a></p></li></ul></div>
</li>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1846212"></a>Class Index</h2></div></div></div>
<a name="id1853097"></a>Class Index</h2></div></div></div>
<p><a class="link" href="s02.html#idx_id_30">A</a> <a class="link" href="s02.html#idx_id_31">B</a> <a class="link" href="s02.html#idx_id_32">C</a> <a class="link" href="s02.html#idx_id_33">D</a> <a class="link" href="s02.html#idx_id_34">E</a> <a class="link" href="s02.html#idx_id_35">F</a> <a class="link" href="s02.html#idx_id_36">G</a> <a class="link" href="s02.html#idx_id_37">H</a> <a class="link" href="s02.html#idx_id_38">I</a> <a class="link" href="s02.html#idx_id_41">L</a> <a class="link" href="s02.html#idx_id_42">M</a> <a class="link" href="s02.html#idx_id_43">N</a> <a class="link" href="s02.html#idx_id_44">O</a> <a class="link" href="s02.html#idx_id_45">P</a> <a class="link" href="s02.html#idx_id_46">Q</a> <a class="link" href="s02.html#idx_id_47">R</a> <a class="link" href="s02.html#idx_id_48">S</a> <a class="link" href="s02.html#idx_id_49">T</a> <a class="link" href="s02.html#idx_id_50">U</a> <a class="link" href="s02.html#idx_id_52">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1845036"></a>Typedef Index</h2></div></div></div>
<a name="id1851892"></a>Typedef Index</h2></div></div></div>
<p><a class="link" href="s03.html#idx_id_58">A</a> <a class="link" href="s03.html#idx_id_59">B</a> <a class="link" href="s03.html#idx_id_60">C</a> <a class="link" href="s03.html#idx_id_61">D</a> <a class="link" href="s03.html#idx_id_62">E</a> <a class="link" href="s03.html#idx_id_63">F</a> <a class="link" href="s03.html#idx_id_64">G</a> <a class="link" href="s03.html#idx_id_65">H</a> <a class="link" href="s03.html#idx_id_66">I</a> <a class="link" href="s03.html#idx_id_69">L</a> <a class="link" href="s03.html#idx_id_71">N</a> <a class="link" href="s03.html#idx_id_72">O</a> <a class="link" href="s03.html#idx_id_73">P</a> <a class="link" href="s03.html#idx_id_75">R</a> <a class="link" href="s03.html#idx_id_76">S</a> <a class="link" href="s03.html#idx_id_77">T</a> <a class="link" href="s03.html#idx_id_78">U</a> <a class="link" href="s03.html#idx_id_79">V</a> <a class="link" href="s03.html#idx_id_80">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1849730"></a>Macro Index</h2></div></div></div>
<a name="id1857795"></a>Macro Index</h2></div></div></div>
<p><a class="link" href="s04.html#idx_id_87">B</a> <a class="link" href="s04.html#idx_id_91">F</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@@ -23,7 +23,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1854128"></a>Index</h2></div></div></div>
<a name="id1862031"></a>Index</h2></div></div></div>
<p><a class="link" href="s05.html#idx_id_112">2</a> <a class="link" href="s05.html#idx_id_113">4</a> <a class="link" href="s05.html#idx_id_114">A</a> <a class="link" href="s05.html#idx_id_115">B</a> <a class="link" href="s05.html#idx_id_116">C</a> <a class="link" href="s05.html#idx_id_117">D</a> <a class="link" href="s05.html#idx_id_118">E</a> <a class="link" href="s05.html#idx_id_119">F</a> <a class="link" href="s05.html#idx_id_120">G</a> <a class="link" href="s05.html#idx_id_121">H</a> <a class="link" href="s05.html#idx_id_122">I</a> <a class="link" href="s05.html#idx_id_123">J</a> <a class="link" href="s05.html#idx_id_124">K</a> <a class="link" href="s05.html#idx_id_125">L</a> <a class="link" href="s05.html#idx_id_126">M</a> <a class="link" href="s05.html#idx_id_127">N</a> <a class="link" href="s05.html#idx_id_128">O</a> <a class="link" href="s05.html#idx_id_129">P</a> <a class="link" href="s05.html#idx_id_130">Q</a> <a class="link" href="s05.html#idx_id_131">R</a> <a class="link" href="s05.html#idx_id_132">S</a> <a class="link" href="s05.html#idx_id_133">T</a> <a class="link" href="s05.html#idx_id_134">U</a> <a class="link" href="s05.html#idx_id_135">V</a> <a class="link" href="s05.html#idx_id_136">W</a> <a class="link" href="s05.html#idx_id_137">X</a> <a class="link" href="s05.html#idx_id_138">Y</a> <a class="link" href="s05.html#idx_id_139">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -4259,13 +4259,6 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">Implementation of Float128 type</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">quadmath_snprintf</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">strtoflt128</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">Incomplete Beta Function Inverses</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/sf_beta/ibeta_inv_function.html" title="The Incomplete Beta Function Inverses"><span class="index-entry-level-1">41</span></a></p></li>
@@ -5900,10 +5893,6 @@
</dt>
<dd><div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">quadmath_snprintf</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">Implementation of Float128 type</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">quantile</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/stat_tut/overview/complements.html" title="Complements are supported too - and when to use them"><span class="index-entry-level-1">Complements are supported too - and when to use them</span></a></p></li>
@@ -6656,10 +6645,6 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">strtoflt128</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/float128.html" title="Implementation of Float128 type"><span class="index-entry-level-1">Implementation of Float128 type</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">Students t Distribution</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/students_t_dist.html" title="Students t Distribution"><span class="index-entry-level-1">accuracy</span></a></p></li>

View File

@@ -27,7 +27,7 @@
<a name="math_toolkit.conventions"></a><a class="link" href="conventions.html" title="Document Conventions">Document Conventions</a>
</h2></div></div></div>
<p>
<a class="indexterm" name="id994455"></a>
<a class="indexterm" name="id1001670"></a>
</p>
<p>
This documentation aims to use of the following naming and formatting conventions.

View File

@@ -87,46 +87,8 @@
C __float128 quadmath type</a>
</h5>
<p>
Example of using GCC Quad-Precision Math Library quadmath <code class="computeroutput"><span class="identifier">__float128</span></code>
type, taking a square root with sqrtq, and output using quadmath_snprintf.
[quadmath_snprintf_1]
</p>
<p>
From GCC Quad-Precision Math Library, <a href="https://gcc.gnu.org/onlinedocs/libquadmath.pdf" target="_top">3.2
quadmath_snprintf, Convert to string</a> (pages 9 and 10).
</p>
<p>
Requires GCC linker option <code class="computeroutput"><span class="special">-</span><span class="identifier">lquadmath</span></code>.
</p>
<p>
If this linker option is missing then you will get errors like:
</p>
<pre class="programlisting"><span class="special">/</span><span class="identifier">Cpp</span><span class="special">/</span><span class="identifier">float128</span><span class="special">/</span><span class="identifier">quadmath_snprintf</span><span class="special">/</span><span class="identifier">quadmath_snprintf</span><span class="special">.</span><span class="identifier">c</span><span class="special">:</span><span class="number">44</span><span class="special">:</span> <span class="identifier">undefined</span> <span class="identifier">reference</span> <span class="identifier">to</span> <span class="char">'sqrtq'</span><span class="special">.</span>
<span class="special">/</span><span class="identifier">Cpp</span><span class="special">/</span><span class="identifier">float128</span><span class="special">/</span><span class="identifier">quadmath_snprintf</span><span class="special">/</span><span class="identifier">quadmath_snprintf</span><span class="special">.</span><span class="identifier">c</span><span class="special">:</span><span class="number">45</span><span class="special">:</span> <span class="identifier">undefined</span> <span class="identifier">reference</span> <span class="identifier">to</span> <span class="char">'quadmath_snprintf'</span><span class="special">.</span>
</pre>
<p>
On one system, the header file (that contains all the <code class="computeroutput"><span class="keyword">extern</span></code>
declarations), included, for example:
</p>
<pre class="programlisting"><span class="keyword">extern</span> <span class="identifier">__float128</span> <span class="identifier">sqrtq</span> <span class="special">(</span><span class="identifier">__float128</span><span class="special">)</span> <span class="identifier">__quadmath_throw</span><span class="special">;</span>
<span class="keyword">extern</span> <span class="identifier">__float128</span> <span class="identifier">strtoflt128</span> <span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*,</span> <span class="keyword">char</span> <span class="special">**)</span> <span class="identifier">__quadmath_throw</span><span class="special">;</span>
<span class="keyword">extern</span> <span class="keyword">int</span> <span class="identifier">quadmath_snprintf</span> <span class="special">(</span><span class="keyword">char</span> <span class="special">*</span><span class="identifier">str</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">size</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="identifier">format</span><span class="special">,</span> <span class="special">...)</span> <span class="identifier">__quadmath_throw</span><span class="special">;</span>
</pre>
<p>
An example of a location of <code class="computeroutput"><span class="identifier">quadmath</span><span class="special">.</span><span class="identifier">h</span></code> is
</p>
<pre class="programlisting"><span class="identifier">C</span><span class="special">:\</span><span class="identifier">program</span> <span class="identifier">files</span><span class="special">\</span><span class="identifier">gcc</span><span class="special">-</span><span class="number">6</span><span class="special">-</span><span class="identifier">win64</span><span class="special">\</span><span class="identifier">lib</span><span class="special">\</span><span class="identifier">gcc</span><span class="special">\</span><span class="identifier">x86_64</span><span class="special">-</span><span class="identifier">w64</span><span class="special">-</span><span class="identifier">mingw32</span><span class="special">\</span><span class="number">6.1</span><span class="special">.</span><span class="number">1</span><span class="special">\</span><span class="identifier">include</span><span class="special">\</span><span class="identifier">quadmath</span><span class="special">.</span><span class="identifier">h</span>
</pre>
<p>
and library at
</p>
<pre class="programlisting"><span class="identifier">C</span><span class="special">:\</span><span class="identifier">Program</span> <span class="identifier">Files</span><span class="special">\</span><span class="identifier">gcc</span><span class="special">-</span><span class="number">6</span><span class="special">-</span><span class="identifier">win64</span><span class="special">\</span><span class="identifier">bin</span><span class="special">\</span><span class="identifier">libquadmath</span><span class="special">-</span><span class="number">0.dll</span>
</pre>
<p>
Command lines used (using <a href="http://www.codeblocks.org" target="_top">CodeBLocks</a>:
</p>
<pre class="programlisting"><span class="identifier">gcc</span><span class="special">.</span><span class="identifier">exe</span> <span class="special">-</span><span class="identifier">Wall</span> <span class="special">-</span><span class="identifier">g</span> <span class="special">-</span><span class="identifier">c</span> <span class="identifier">J</span><span class="special">:\</span><span class="identifier">Cpp</span><span class="special">\</span><span class="identifier">float128</span><span class="special">\</span><span class="identifier">quadmath_snprintf</span><span class="special">\</span><span class="identifier">main</span><span class="special">.</span><span class="identifier">c</span> <span class="special">-</span><span class="identifier">o</span> <span class="identifier">obj</span><span class="special">\</span><span class="identifier">Debug</span><span class="special">\</span><span class="identifier">main</span><span class="special">.</span><span class="identifier">o</span>
<span class="identifier">g</span><span class="special">++.</span><span class="identifier">exe</span> <span class="special">-</span><span class="identifier">o</span> <span class="identifier">bin</span><span class="special">\</span><span class="identifier">Debug</span><span class="special">\</span><span class="identifier">quadmath_snprintf</span><span class="special">.</span><span class="identifier">exe</span> <span class="identifier">obj</span><span class="special">\</span><span class="identifier">Debug</span><span class="special">\</span><span class="identifier">main</span><span class="special">.</span><span class="identifier">o</span> <span class="special">-</span><span class="identifier">lquadmath</span>
</pre>
<p>
The source code is at <a href="../../../example/quadmath_snprintf.c" target="_top">quadmath_snprintf.c</a>.
</p>

View File

@@ -34,15 +34,20 @@
</h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
__float128 is the compiler supplied hardware type, it's an C-ish extension
to C++ and there is only minimal support for it in normal C++ (no IO streams
or <code class="computeroutput"><span class="identifier">numeric_limits</span></code> support,
function names in libquadmath all have different names to the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code>
ones etc.) So you can program that type directly but it's harder work.
__float128 is the (optionally) compiler supplied hardware type, it's an
C-ish extension to C++ and there is only minimal support for it in normal
C++ (no IO streams or <code class="computeroutput"><span class="identifier">numeric_limits</span></code>
support, function names in libquadmath all have different names to the
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code>
ones etc.) So you can program type <code class="computeroutput"><span class="identifier">__float128</span></code>
directly, but it's harder work.
</li>
<li class="listitem">
Type float128 is a thin wrapper around __float128 and makes it C++ and
generic code friendly.
Type <code class="computeroutput"><span class="identifier">float128</span></code> uses __float128
and makes it C++ and generic code friendly, with all the usual standard
<code class="computeroutput"><span class="identifier">iostream</span></code>, <code class="computeroutput"><span class="identifier">numeric_limits</span></code>, <code class="computeroutput"><span class="identifier">complex</span></code>
in namspace <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code>
available, so strongly recommended for C++ use.
</li>
</ul></div>
<h6>

View File

@@ -27,7 +27,7 @@
<a name="math_toolkit.navigation"></a><a class="link" href="navigation.html" title="Navigation">Navigation</a>
</h2></div></div></div>
<p>
<a class="indexterm" name="id994329"></a>
<a class="indexterm" name="id990144"></a>
</p>
<p>
Boost.Math documentation is provided in both HTML and PDF formats.

View File

@@ -70,7 +70,7 @@
if the underlying type is not provided by the compiler</strong></span>. For example,
if a compiler does not have an underlying floating-point type with 128 bits
(highly sought-after in scientific and numeric programming), then <code class="computeroutput"><span class="identifier">float128_t</span></code> and its corresponding least
and fast types are not provided by <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span></code>&gt;.
and fast types are <span class="bold"><strong>not</strong></span> provided by <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span></code>&gt;.
</p></td></tr>
</table></div>
<div class="warning"><table border="0" summary="Warning">

View File

@@ -65,6 +65,21 @@
all platforms/compilers, because compiler support for a 128-bit floating-point
type is not mandated by either the C standard or the C++ standard.
</p>
<p>
If 128-bit floating-point is supported, then including <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">cstdfloat</span><span class="special">.</span><span class="identifier">hpp</span></code> provides
a <span class="bold"><strong>native</strong></span> 128-bit type, and includes other
headers in folder <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">cstdfloat</span></code>
that provide C++ quad support for <a href="http://www.cplusplus.com/reference/cmath/" target="_top">C
math functions</a> in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span></code>,
<code class="computeroutput"><span class="special">&lt;</span><span class="identifier">limits</span><span class="special">&gt;</span></code>, <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span></code>,
<code class="computeroutput"><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">&gt;</span></code>, and the available floating-point types.
</p>
<p>
One can also, more robustly, include <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">float128</span><span class="special">.</span><span class="identifier">hpp</span></code> and
this provides a thin wrapper selecting the appropriate 128-bit native type
from <code class="computeroutput"><span class="identifier">cstdfloat</span></code> if available,
or else a 128-bit multiprecision type.
</p>
<p>
See <a class="link" href="examples.html#math_toolkit.examples.je_lambda">Jahnke-Emden-Lambda function
example</a> for an example using both a <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span></code>

View File

@@ -428,6 +428,7 @@ and use the function's name as the link text.]
[def __random_variate [@http://en.wikipedia.org/wiki/Random_variate random variate]]
[def __random_variable [@http://en.wikipedia.org/wiki/Random_variable random variable]]
[def __probability_distribution [@http://en.wikipedia.org/wiki/Probability_distribution probability_distribution]]
[def __C_math [@http://www.cplusplus.com/reference/cmath/ C math functions]]
[/ Some composite templates]
[template super[x]'''<superscript>'''[x]'''</superscript>''']

View File

@@ -20,7 +20,7 @@ The Jahnke-Emden lambda function is described at
Weisstein, Eric W. "Lambda Function." From MathWorld--A Wolfram Web Resource.
http://mathworld.wolfram.com/LambdaFunction.html
E. Jahnke and F. Emde, "Tables of Functions with Formulae and Curves,"
E. Jahnke and F. Emden, "Tables of Functions with Formulae and Curves,"
Dover, New York, 4th ed., (1945), pages 180-188.
*/

View File

@@ -36,7 +36,7 @@
/*`To make float128 available it is vital to get the dialect and options on the command line correct.
Quad type is forbidden by all the strict C++ standards, so using or adding -std=c++11 and later standards will prevent its use.
so explicitly use -std=gnu++11, 1y, 14, , 1z or 17 ...
so explicitly use -std=gnu++11, 1y, 14, 17, or 1z or ...
For GCC 6.1.1, for example, the default is if no C++ language dialect options are given, is -std=gnu++14.
@@ -56,6 +56,7 @@ If this is missing, then get errors like:
Requires compile option
-fext-numeric-literals
If missing, then get errors like:
\modular-boost\libs\math\include/boost/math/cstdfloat/cstdfloat_types.hpp:229:43: error: unable to find numeric literal operator 'operator""Q'
@@ -162,24 +163,16 @@ int main()
// But sadly functions like sqrt are not yet available constexpr for float128.
//constexpr float128 root_pi_constexpr = sqrt(pi_constexpr); // Fails - not constexpr (yet).
//constexpr float128 root_pi_constexpr = std::sqrt(pi_constexpr); // Fails - no know conversion for argument 1 from 'const float128'.
// constexpr float128 root_pi_constexpr = sqrt(pi_constexpr); // Fails - not constexpr (yet).
// constexpr float128 root_pi_constexpr = std::sqrt(pi_constexpr); // Fails - no known conversion for argument 1 from 'const float128'.
// constexpr float128 root_pi_constexpr = sqrt(pi_constexpr); // Call to non-constexpr
//constexpr float128 root_pi_constexpr = boost::math::constants::root_pi(); // Missing type for constant.
// constexpr float128 root_pi_constexpr = boost::math::constants::root_pi(); // Missing type for constant.
// Best current way to get a constexpr is to use a Boost.Math constant if one is available.
constexpr float128 root_pi_constexpr = boost::math::constants::root_pi<float128>();
std::cout << root_pi_constexpr << std::endl; // 1.77245385090551602729816748334114514
/*
inline _GLIBCXX_CONSTEXPR long double
sqrt(long double __x)
{ return __builtin_sqrtl(__x); }
Need a float128 version of __builtin_sqrt_128.
*/
// Note that casts within the sqrt call are NOT NEEDED (nor allowed)
// Note that casts within the sqrt call are NOT NEEDED (nor allowed),
// since all the variables are the correct type to begin with.
// std::cout << sqrt<float128>(pi3) << std::endl;
// But note examples of catastrophic (but hard to see) loss of precision below.

View File

@@ -1,93 +0,0 @@
// Original source file copyright gcc.gnu.org, GNU Free Documentation License, Version 1.3.
// Notes for Boost.Math, (contains Quickbook snippets as C/C++ comments - do not remove!)
// Copyright Paul Bristow 2016.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//[quadmath_snprintf_1
/*`Example of using GCC Quad-Precision Math Library quadmath `__float128` type,
taking a square root with sqrtq, and output using quadmath_snprintf.
From GCC Quad-Precision Math Library,
[@https://gcc.gnu.org/onlinedocs/libquadmath.pdf 3.2 quadmath_snprintf, Convert to string]
(pages 9 and 10).
Requires GCC linker option `-lquadmath`.
If this linker option is missing then you will get errors like:
``
/Cpp/float128/quadmath_snprintf/quadmath_snprintf.c:44: undefined reference to 'sqrtq'.
/Cpp/float128/quadmath_snprintf/quadmath_snprintf.c:45: undefined reference to 'quadmath_snprintf'.
``
On one system, the header file (that contains all the `extern` declarations), included, for example:
``
extern __float128 sqrtq (__float128) __quadmath_throw;
extern __float128 strtoflt128 (const char *, char **) __quadmath_throw;
extern int quadmath_snprintf (char *str, size_t size, const char *format, ...) __quadmath_throw;
``
An example of a location of `quadmath.h` is
``
C:\program files\gcc-6-win64\lib\gcc\x86_64-w64-mingw32\6.1.1\include\quadmath.h
``
and library at
``
C:\Program Files\gcc-6-win64\bin\libquadmath-0.dll
``
Command lines used (using [@http://www.codeblocks.org CodeBLocks]:
``
gcc.exe -Wall -g -c J:\Cpp\float128\quadmath_snprintf\main.c -o obj\Debug\main.o
g++.exe -o bin\Debug\quadmath_snprintf.exe obj\Debug\main.o -lquadmath
``
*/
//] [/quadmath_snprintf_1]
#include <quadmath.h>
#include <stdlib.h>
#include <stdio.h>
int main ()
{
__float128 r;
int prec = 20;
int width = 46;
char buf[128];
r = 2.0q;
r = sqrtq (r);
int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r);
if ((size_t) n < sizeof buf)
printf ("%s\n", buf);
/* Prints: +1.41421356237309504880e+00 */
quadmath_snprintf (buf, sizeof buf, "%Qa", r);
if ((size_t) n < sizeof buf)
printf ("%s\n", buf);
/* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */
n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r);
if (n > -1)
{
char *str = malloc (n + 1);
if (str)
{
quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r);
printf ("%s\n", str);
/* Prints: +1.41421356237309504880e+00 */
}
free (str);
}
return 0;
}
/*
Output:
+1.41421356237309504880e+00
0x1.6a09e667f3bcc908b2fb1366ea96p+0
+1.41421356237309504880e+00
*/