]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/constants_intro.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / constants_intro.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Introduction</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="../constants.html" title="Chapter&#160;4.&#160;Mathematical Constants">
9 <link rel="prev" href="../constants.html" title="Chapter&#160;4.&#160;Mathematical Constants">
10 <link rel="next" href="tutorial.html" title="Tutorial">
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="../constants.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../constants.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="tutorial.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.constants_intro"></a><a class="link" href="constants_intro.html" title="Introduction">Introduction</a>
28 </h2></div></div></div>
29 <p>
30 Boost.Math provides a collection of mathematical constants.
31 </p>
32 <h5>
33 <a name="math_toolkit.constants_intro.h0"></a>
34 <span class="phrase"><a name="math_toolkit.constants_intro.why_use_boost_math_mathematical_"></a></span><a class="link" href="constants_intro.html#math_toolkit.constants_intro.why_use_boost_math_mathematical_">Why
35 use Boost.Math mathematical constants?</a>
36 </h5>
37 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
38 <li class="listitem">
39 <p class="simpara">
40 Readable. For the very many jobs just using built-in like <code class="computeroutput"><span class="keyword">double</span></code>, you can just write expressions like
41 </p>
42 <pre class="programlisting"><span class="keyword">double</span> <span class="identifier">area</span> <span class="special">=</span> <span class="identifier">pi</span> <span class="special">*</span> <span class="identifier">r</span> <span class="special">*</span> <span class="identifier">r</span><span class="special">;</span></pre>
43 <p class="simpara">
44 (If that's all you want, jump direct to <a class="link" href="tutorial/non_templ.html" title="Use in non-template code">use
45 in non-template code</a>!)
46 </p>
47 </li>
48 <li class="listitem">
49 Effortless - avoiding a search of reference sources.
50 </li>
51 <li class="listitem">
52 Usable with both builtin floating point types, and user-defined, possibly
53 extended precision, types such as NTL, MPFR/GMP, mp_float: in the latter
54 case the constants are computed to the necessary precision and then cached.
55 </li>
56 <li class="listitem">
57 Accurate - ensuring that the values are as accurate as possible for the
58 chosen floating-point type
59 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
60 <li class="listitem">
61 No loss of accuracy from repeated rounding of intermediate computations.
62 </li>
63 <li class="listitem">
64 Result is computed with higher precision and only rounded once.
65 </li>
66 <li class="listitem">
67 Less risk of inaccurate result from functions pow, trig and log at
68 <a href="http://en.wikipedia.org/wiki/Corner_case" target="_top">corner cases</a>.
69 </li>
70 <li class="listitem">
71 Less risk of <a href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" target="_top">cancellation
72 error</a>.
73 </li>
74 </ul></div>
75 </li>
76 <li class="listitem">
77 Portable - as possible between different systems using different floating-point
78 precisions: see <a class="link" href="tutorial/templ.html" title="Use in template code">use in template
79 code</a>.
80 </li>
81 <li class="listitem">
82 Tested - by comparison with other published sources, or separately computed
83 at long double precision.
84 </li>
85 <li class="listitem">
86 Faster - can avoid (re-)calculation at runtime.
87 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
88 <li class="listitem">
89 If the value returned is a builtin type then it's returned by value
90 as a <code class="computeroutput"><span class="keyword">constexpr</span></code> (C++11
91 feature, if available).
92 </li>
93 <li class="listitem">
94 If the value is computed and cached (or constructed from a string
95 representation and cached), then it's returned by constant reference.<br>
96 This can be significant if:
97 </li>
98 <li class="listitem">
99 Functions pow, trig or log are used.
100 </li>
101 <li class="listitem">
102 Inside an inner loop.
103 </li>
104 <li class="listitem">
105 Using a high-precision UDT like <a href="../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>.
106 </li>
107 <li class="listitem">
108 Compiler optimizations possible with built-in types, especially
109 <code class="computeroutput"><span class="keyword">double</span></code>, are not available.
110 </li>
111 </ul></div>
112 </li>
113 </ul></div>
114 </div>
115 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
116 <td align="left"></td>
117 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
118 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
119 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
120 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
121 Distributed under the Boost Software License, Version 1.0. (See accompanying
122 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>)
123 </p>
124 </div></td>
125 </tr></table>
126 <hr>
127 <div class="spirit-nav">
128 <a accesskey="p" href="../constants.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../constants.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="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
129 </div>
130 </body>
131 </html>