summaryrefslogtreecommitdiff
path: root/libs/math/doc/html/math_toolkit/float128.html
blob: 96865120a271466083e92433357b34e83d18a0c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Implementation of Float128 type</title>
<link rel="stylesheet" href="../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="../index.html" title="Math Toolkit 2.2.0">
<link rel="up" href="../cstdfloat.html" title="Chapter&#160;3.&#160;Specified-width floating-point typedefs">
<link rel="prev" href="examples.html" title="Examples">
<link rel="next" href="float128/overloading_template_functions_w.html" title="Overloading template functions with float128_t">
</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="examples.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../cstdfloat.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/overloading_template_functions_w.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="math_toolkit.float128"></a><a class="link" href="float128.html" title="Implementation of Float128 type">Implementation of Float128 type</a>
</h2></div></div></div>
<div class="toc"><dl>
<dt><span class="section"><a href="float128/overloading_template_functions_w.html">Overloading
      template functions with float128_t</a></span></dt>
<dt><span class="section"><a href="float128/exp_function.html">Exponential function</a></span></dt>
<dt><span class="section"><a href="float128/typeinfo.html"><code class="computeroutput"><span class="identifier">typeinfo</span></code></a></span></dt>
</dl></div>
<p>
      Since few compilers implement a true 128-bit floating-point, and language features
      like the suffix Q, and C++ Standard library functions are as-yet missing or
      incomplete in C++11, this Boost.Math implementation wraps <code class="computeroutput"><span class="identifier">__float128</span></code>
      provided by the GCC compiler or the <code class="computeroutput"><span class="identifier">_Quad</span></code>
      type provided by the Intel compiler.
    </p>
<p>
      This is provided to in order to demonstrate, and users to evaluate, the feasibility
      and benefits of higher-precision floating-point, especially to allow use of
      the full Boost.Math library of functions and distributions at high precision.
    </p>
<p>
      (It is also possible to use Boost.Math with Boost.Multiprecision decimal and
      binary, but since these are entirely software solutions, allowing much higher
      precision or arbitrary precision, they are likely to be slower).
    </p>
<p>
      We also provide (we believe full) support for <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">limits</span><span class="special">&gt;,</span> <span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span></code>, I/O stream operations in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span></code>, and <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">complex</span><span class="special">&gt;</span></code>.
    </p>
<p>
      As a prototype for a future C++ standard, we place all these in <code class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">std</span></code>.
      This contravenes the existing C++ standard of course, so selecting any compiler
      that promises to check conformance will fail.
    </p>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
        For GCC, compile with <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">gnu</span><span class="special">++</span><span class="number">11</span></code> or <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">gnu</span><span class="special">++</span><span class="number">03</span></code> and do
        not use <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">stdc</span><span class="special">++</span><span class="number">11</span></code>or any 'strict' options as these turn off
        full support for <code class="computeroutput"><span class="identifier">__float128</span></code>.
        These requirements also apply to the Intel compiler on Linux, for Intel on
        Windows you need to compile with <code class="computeroutput"><span class="special">-</span><span class="identifier">Qoption</span><span class="special">,</span><span class="identifier">cpp</span><span class="special">,--</span><span class="identifier">extended_float_type</span> <span class="special">-</span><span class="identifier">DBOOST_MATH_USE_FLOAT128</span></code> in order to activate
        128-bit floating point support.
      </p></td></tr>
</table></div>
<p>
      The <code class="computeroutput"><span class="identifier">__float128</span></code> type is provided
      by the <a href="http://gcc.gnu.org/onlinedocs/libquadmath/" target="_top">libquadmath
      library</a> on GCC or by Intel's FORTRAN library with Intel C++.
    </p>
<p>
      A typical invocation of the compiler is
    </p>
<pre class="programlisting"><span class="identifier">g</span><span class="special">++</span> <span class="special">-</span><span class="identifier">O3</span> <span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">gnu</span><span class="special">++</span><span class="number">11</span> <span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">-</span><span class="identifier">I</span><span class="special">/</span><span class="identifier">c</span><span class="special">/</span><span class="identifier">modular</span><span class="special">-</span><span class="identifier">boost</span> <span class="special">-</span><span class="identifier">lquadmath</span> <span class="special">-</span><span class="identifier">o</span> <span class="identifier">test</span><span class="special">.</span><span class="identifier">exe</span>
</pre>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
        If you are trying to use the develop branch of Boost.Math, then make <code class="computeroutput"><span class="special">-</span><span class="identifier">I</span><span class="special">/</span><span class="identifier">c</span><span class="special">/</span><span class="identifier">modular</span><span class="special">-</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">include</span></code>
        the <span class="bold"><strong>first</strong></span> include directory.
      </p></td></tr>
</table></div>
<pre class="programlisting"><span class="identifier">g</span><span class="special">++</span> <span class="special">-</span><span class="identifier">O3</span> <span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">gnu</span><span class="special">++</span><span class="number">11</span> <span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">-</span><span class="identifier">I</span><span class="special">/</span><span class="identifier">c</span><span class="special">/</span><span class="identifier">modular</span><span class="special">-</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">include</span> <span class="special">-</span><span class="identifier">I</span><span class="special">/</span><span class="identifier">c</span><span class="special">/</span><span class="identifier">modular</span><span class="special">-</span><span class="identifier">boost</span> <span class="special">-</span><span class="identifier">lquadmath</span> <span class="special">-</span><span class="identifier">o</span> <span class="identifier">test</span><span class="special">.</span><span class="identifier">exe</span>
</pre>
<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>
        So far, the only missing detail that we have noted is in trying to use <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">typeinfo</span><span class="special">&gt;</span></code>, for example for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="keyword">typeid</span><span class="special">&lt;</span><span class="identifier">__float_128</span><span class="special">&gt;.</span><span class="identifier">name</span><span class="special">();</span></code>. Link fails: undefined reference to <code class="computeroutput"><span class="identifier">typeinfo</span> <span class="keyword">for</span>
        <span class="identifier">__float128</span></code>. See <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43622" target="_top">GCC
        Bug 43622 - no C++ typeinfo for __float128</a>.
      </p></td></tr>
</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
      Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
      Holin, Bruno Lalande, John Maddock, 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="examples.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../cstdfloat.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/overloading_template_functions_w.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>