Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / specified_typedefs.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Overview</title>
5 <link rel="stylesheet" href="../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../index.html" title="Math Toolkit 2.11.0">
8 <link rel="up" href="../cstdfloat.html" title="Chapter&#160;3.&#160;Specified-width floating-point typedefs">
9 <link rel="prev" href="../cstdfloat.html" title="Chapter&#160;3.&#160;Specified-width floating-point typedefs">
10 <link rel="next" href="rationale.html" title="Rationale">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../cstdfloat.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="rationale.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="math_toolkit.specified_typedefs"></a><a class="link" href="specified_typedefs.html" title="Overview">Overview</a>
28 </h2></div></div></div>
29 <p>
30       The header <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><span class="special">&gt;</span></code>
31       provides <span class="bold"><strong>optional</strong></span> standardized floating-point
32       <code class="computeroutput"><span class="keyword">typedef</span></code>s having <span class="bold"><strong>specified
33       widths</strong></span>. These are useful for writing portable code because they
34       should behave identically on all platforms. These <code class="computeroutput"><span class="keyword">typedef</span></code>s
35       are the floating-point analog of specified-width integers in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">cstdint</span><span class="special">&gt;</span></code> and <code class="computeroutput"><span class="identifier">stdint</span><span class="special">.</span><span class="identifier">h</span></code>.
36     </p>
37 <p>
38       The <code class="computeroutput"><span class="keyword">typedef</span></code>s are based on <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3626.pdf" target="_top">N3626</a>
39       proposed for a new C++14 standard header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">cstdfloat</span><span class="special">&gt;</span></code>
40       and <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1703.pdf" target="_top">N1703</a>
41       proposed for a new C language standard header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">stdfloat</span><span class="special">.</span><span class="identifier">h</span><span class="special">&gt;</span></code>.
42     </p>
43 <p>
44       All <code class="computeroutput"><span class="keyword">typedef</span></code>s are in <code class="computeroutput"><span class="keyword">namespace</span> <span class="identifier">boost</span></code>
45       (would be in namespace <code class="computeroutput"><span class="identifier">std</span></code>
46       if eventually standardized).
47     </p>
48 <p>
49       The <code class="computeroutput"><span class="keyword">typedef</span></code>s include <code class="computeroutput"><span class="identifier">float16_t</span><span class="special">,</span> <span class="identifier">float32_t</span><span class="special">,</span> <span class="identifier">float64_t</span><span class="special">,</span> <span class="identifier">float80_t</span><span class="special">,</span> <span class="identifier">float128_t</span></code>, their corresponding least and
50       fast types, and the corresponding maximum-width type. The <code class="computeroutput"><span class="keyword">typedef</span></code>s
51       are based on underlying built-in types such as <code class="computeroutput"><span class="keyword">float</span></code>,
52       <code class="computeroutput"><span class="keyword">double</span></code>, or <code class="computeroutput"><span class="keyword">long</span>
53       <span class="keyword">double</span></code>, or the proposed <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2016.pdf" target="_top">N2016
54       short float type</a>, or based on other compiler-specific non-standardized
55       types such as <code class="computeroutput"><span class="identifier">__float128</span></code>. The
56       underlying types of these <code class="computeroutput"><span class="keyword">typedef</span></code>s
57       must conform with the corresponding specifications of binary16, binary32, binary64,
58       and binary128 in <a href="http://en.wikipedia.org/wiki/IEEE_floating_point" target="_top">IEEE_floating_point</a>
59       floating-point format, and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;&gt;::</span><span class="identifier">is_iec559</span>
60       <span class="special">==</span> <span class="keyword">true</span></code>.
61     </p>
62 <p>
63       The 128-bit floating-point type (of great interest in scientific and numeric
64       programming) is not required in the Boost header, and may not be supplied for
65       all platforms/compilers, because compiler support for a 128-bit floating-point
66       type is not mandated by either the C standard or the C++ standard.
67     </p>
68 <p>
69       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
70       a <span class="bold"><strong>native</strong></span> 128-bit type, and includes other
71       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>
72       that provide C++ quad support for <a href="http://www.cplusplus.com/reference/cmath/" target="_top">C
73       math functions</a> in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">cmath</span><span class="special">&gt;</span></code>,
74       <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>,
75       <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.
76     </p>
77 <p>
78       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
79       this provides a thin wrapper selecting the appropriate 128-bit native type
80       from <code class="computeroutput"><span class="identifier">cstdfloat</span></code> if available,
81       or else a 128-bit multiprecision type.
82     </p>
83 <p>
84       See <a class="link" href="examples.html#math_toolkit.examples.je_lambda">Jahnke-Emden-Lambda function
85       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>
86       function and a Boost.Math function to evaluate a moderately interesting function,
87       the <a href="http://mathworld.wolfram.com/LambdaFunction.html" target="_top">Jahnke-Emden-Lambda
88       function</a> and <a class="link" href="examples.html#math_toolkit.examples.normal_table">normal
89       distribution</a> as an example of a statistical distribution from Boost.Math.
90     </p>
91 </div>
92 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
93 <td align="left"></td>
94 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
95       Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
96       Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
97       R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
98       Daryle Walker and Xiaogang Zhang<p>
99         Distributed under the Boost Software License, Version 1.0. (See accompanying
100         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>)
101       </p>
102 </div></td>
103 </tr></table>
104 <hr>
105 <div class="spirit-nav">
106 <a accesskey="p" href="../cstdfloat.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="rationale.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
107 </div>
108 </body>
109 </html>