]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/html/math_toolkit/powers/expm1.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / powers / expm1.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>expm1</title>
5<link rel="stylesheet" href="../../math.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
7<link rel="home" href="../../index.html" title="Math Toolkit 2.5.1">
8<link rel="up" href="../powers.html" title="Basic Functions">
9<link rel="prev" href="log1p.html" title="log1p">
10<link rel="next" href="cbrt.html" title="cbrt">
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="log1p.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../powers.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="cbrt.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="math_toolkit.powers.expm1"></a><a class="link" href="expm1.html" title="expm1">expm1</a>
28</h3></div></div></div>
29<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">special_functions</span><span class="special">/</span><span class="identifier">expm1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
30</pre>
31<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
32
33<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
34<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">expm1</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">x</span><span class="special">);</span>
35
36<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
37<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">expm1</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
38
39<span class="special">}}</span> <span class="comment">// namespaces</span>
40</pre>
41<p>
42 Returns e<sup>x</sup> - 1.
43 </p>
44<p>
45 The return type of this function is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result
46 type calculation rules</em></span></a>: the return is <code class="computeroutput"><span class="keyword">double</span></code>
47 when <span class="emphasis"><em>x</em></span> is an integer type and T otherwise.
48 </p>
49<p>
50 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
51 be used to control the behaviour of the function: how it handles errors,
52 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
53 documentation for more details</a>.
54 </p>
55<p>
56 For small x, then <code class="computeroutput">e<sup>x</sup></code> is very close to 1, as a result calculating <code class="computeroutput">e<sup>x</sup> - 1</code> results in
57 catastrophic cancellation errors when x is small. <code class="computeroutput"><span class="identifier">expm1</span></code>
58 calculates <code class="computeroutput">e<sup>x</sup> - 1</code> using rational approximations (for up to 128-bit long doubles),
59 otherwise via a series expansion when x is small (giving an accuracy of less
60 than 2&#603;).
61 </p>
62<p>
63 Finally when BOOST_HAS_EXPM1 is defined then the <code class="computeroutput"><span class="keyword">float</span><span class="special">/</span><span class="keyword">double</span><span class="special">/</span><span class="keyword">long</span> <span class="keyword">double</span></code>
64 specializations of this template simply forward to the platform's native
65 (POSIX) implementation of this function.
66 </p>
67<p>
68 The following graph illustrates the behaviour of expm1:
69 </p>
70<p>
71 <span class="inlinemediaobject"><img src="../../../graphs/expm1.svg" align="middle"></span>
72 </p>
73<h5>
74<a name="math_toolkit.powers.expm1.h0"></a>
75 <span class="phrase"><a name="math_toolkit.powers.expm1.accuracy"></a></span><a class="link" href="expm1.html#math_toolkit.powers.expm1.accuracy">Accuracy</a>
76 </h5>
77<p>
78 For built in floating point types <code class="computeroutput"><span class="identifier">expm1</span></code>
79 should have approximately 1 epsilon accuracy.
80 </p>
81<div class="table">
82<a name="math_toolkit.powers.expm1.table_expm1"></a><p class="title"><b>Table&#160;6.79.&#160;Error rates for expm1</b></p>
83<div class="table-contents"><table class="table" summary="Error rates for expm1">
84<colgroup>
85<col>
86<col>
87<col>
88<col>
89<col>
90</colgroup>
91<thead><tr>
92<th>
93 </th>
94<th>
95 <p>
96 Microsoft Visual C++ version 12.0<br> Win32<br> double
97 </p>
98 </th>
99<th>
100 <p>
101 GNU C++ version 5.1.0<br> linux<br> double
102 </p>
103 </th>
104<th>
105 <p>
106 GNU C++ version 5.1.0<br> linux<br> long double
107 </p>
108 </th>
109<th>
110 <p>
111 Sun compiler version 0x5130<br> Sun Solaris<br> long double
112 </p>
113 </th>
114</tr></thead>
115<tbody><tr>
116<td>
117 <p>
118 Random test data
119 </p>
120 </td>
121<td>
122 <p>
123 <span class="blue">Max = 0.996&#949; (Mean = 0.283&#949;)</span><br> <br>
124 (<span class="emphasis"><em>&lt;math.h&gt;:</em></span> Max = 1.31&#949; (Mean = 0.496&#949;))
125 </p>
126 </td>
127<td>
128 <p>
129 <span class="blue">Max = 0.793&#949; (Mean = 0.126&#949;)</span><br> <br>
130 (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 0.793&#949; (Mean = 0.126&#949;))<br>
131 (<span class="emphasis"><em>Cephes:</em></span> Max = 1.53&#949; (Mean = 0.535&#949;))
132 </p>
133 </td>
134<td>
135 <p>
136 <span class="blue">Max = 0.992&#949; (Mean = 0.402&#949;)</span><br> <br>
137 (<span class="emphasis"><em>&lt;tr1/cmath&gt;:</em></span> <span class="red">Max
138 = 1.26e+19&#949; (Mean = 4.89e+18&#949;) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_long_double_expm1__tr1_cmath__Random_test_data">And
139 other failures.</a>)</span><br> (<span class="emphasis"><em>&lt;math.h&gt;:</em></span>
140 Max = 0.992&#949; (Mean = 0.402&#949;))
141 </p>
142 </td>
143<td>
144 <p>
145 <span class="blue">Max = 1.31&#949; (Mean = 0.406&#949;)</span><br> <br>
146 (<span class="emphasis"><em>&lt;math.h&gt;:</em></span> Max = 0.996&#949; (Mean = 0.426&#949;))
147 </p>
148 </td>
149</tr></tbody>
150</table></div>
151</div>
152<br class="table-break"><h5>
153<a name="math_toolkit.powers.expm1.h1"></a>
154 <span class="phrase"><a name="math_toolkit.powers.expm1.testing"></a></span><a class="link" href="expm1.html#math_toolkit.powers.expm1.testing">Testing</a>
155 </h5>
156<p>
157 A mixture of spot test sanity checks, and random high precision test values
158 calculated using NTL::RR at 1000-bit precision.
159 </p>
160</div>
161<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
162<td align="left"></td>
163<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
164 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
165 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
166 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
167 Distributed under the Boost Software License, Version 1.0. (See accompanying
168 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>)
169 </p>
170</div></td>
171</tr></table>
172<hr>
173<div class="spirit-nav">
174<a accesskey="p" href="log1p.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../powers.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="cbrt.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
175</div>
176</body>
177</html>