]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/pol_tutorial/policy_tut_defaults.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / pol_tutorial / policy_tut_defaults.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Policies Have Sensible Defaults</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="../pol_tutorial.html" title="Policy Tutorial">
9 <link rel="prev" href="what_is_a_policy.html" title="So Just What is a Policy Anyway?">
10 <link rel="next" href="policy_usage.html" title="So How are Policies Used Anyway?">
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="what_is_a_policy.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../pol_tutorial.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="policy_usage.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.pol_tutorial.policy_tut_defaults"></a><a class="link" href="policy_tut_defaults.html" title="Policies Have Sensible Defaults">Policies
28 Have Sensible Defaults</a>
29 </h3></div></div></div>
30 <p>
31 Most of the time you can just ignore the policy framework.
32 </p>
33 <p>
34 <span class="emphasis"><em>*The defaults for the various policies are as follows, if these
35 work OK for you then you can stop reading now!</em></span>
36 </p>
37 <div class="variablelist">
38 <p class="title"><b></b></p>
39 <dl class="variablelist">
40 <dt><span class="term">Domain Error</span></dt>
41 <dd><p>
42 Throws a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> exception.
43 </p></dd>
44 <dt><span class="term">Pole Error</span></dt>
45 <dd><p>
46 Occurs when a function is evaluated at a pole: throws a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> exception.
47 </p></dd>
48 <dt><span class="term">Overflow Error</span></dt>
49 <dd><p>
50 Throws a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">overflow_error</span></code> exception.
51 </p></dd>
52 <dt><span class="term">Underflow</span></dt>
53 <dd><p>
54 Ignores the underflow, and returns zero.
55 </p></dd>
56 <dt><span class="term">Denormalised Result</span></dt>
57 <dd><p>
58 Ignores the fact that the result is denormalised, and returns it.
59 </p></dd>
60 <dt><span class="term">Rounding Error</span></dt>
61 <dd><p>
62 Throws a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">rounding_error</span></code> exception.
63 </p></dd>
64 <dt><span class="term">Internal Evaluation Error</span></dt>
65 <dd><p>
66 Throws a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">evaluation_error</span></code> exception.
67 </p></dd>
68 <dt><span class="term">Indeterminate Result Error</span></dt>
69 <dd><p>
70 Returns a result that depends on the function where the error occurred.
71 </p></dd>
72 <dt><span class="term">Promotion of float to double</span></dt>
73 <dd><p>
74 Does occur by default - gives full float precision results.
75 </p></dd>
76 <dt><span class="term">Promotion of double to long double</span></dt>
77 <dd><p>
78 Does occur by default if long double offers more precision than double.
79 </p></dd>
80 <dt><span class="term">Precision of Approximation Used</span></dt>
81 <dd><p>
82 By default uses an approximation that will result in the lowest level
83 of error for the type of the result.
84 </p></dd>
85 <dt><span class="term">Behaviour of Discrete Quantiles</span></dt>
86 <dd>
87 <p>
88 The quantile function will by default return an integer result that
89 has been <span class="emphasis"><em>rounded outwards</em></span>. That is to say lower
90 quantiles (where the probability is less than 0.5) are rounded downward,
91 and upper quantiles (where the probability is greater than 0.5) are
92 rounded upwards. This behaviour ensures that if an X% quantile is requested,
93 then <span class="emphasis"><em>at least</em></span> the requested coverage will be present
94 in the central region, and <span class="emphasis"><em>no more than</em></span> the requested
95 coverage will be present in the tails.
96 </p>
97 <p>
98 This behaviour can be changed so that the quantile functions are rounded
99 differently, or even return a real-valued result using <a class="link" href="../pol_overview.html" title="Policy Overview">Policies</a>.
100 It is strongly recommended that you read the tutorial <a class="link" href="understand_dis_quant.html" title="Understanding Quantiles of Discrete Distributions">Understanding
101 Quantiles of Discrete Distributions</a> before using the quantile
102 function on a discrete distribution. The <a class="link" href="../pol_ref/discrete_quant_ref.html" title="Discrete Quantile Policies">reference
103 docs</a> describe how to change the rounding policy for these distributions.
104 </p>
105 </dd>
106 </dl>
107 </div>
108 <p>
109 What's more, if you define your own policy type, then it automatically inherits
110 the defaults for any policies not explicitly set, so given:
111 </p>
112 <pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">policies</span><span class="special">;</span>
113 <span class="comment">//</span>
114 <span class="comment">// Define a policy that sets ::errno on overflow, and does</span>
115 <span class="comment">// not promote double to long double internally:</span>
116 <span class="comment">//</span>
117 <span class="keyword">typedef</span> <span class="identifier">policy</span><span class="special">&lt;</span><span class="identifier">domain_error</span><span class="special">&lt;</span><span class="identifier">errno_on_error</span><span class="special">&gt;,</span> <span class="identifier">promote_double</span><span class="special">&lt;</span><span class="keyword">false</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">mypolicy</span><span class="special">;</span>
118 </pre>
119 <p>
120 then <code class="computeroutput"><span class="identifier">mypolicy</span></code> defines a policy
121 where only the overflow error handling and <code class="computeroutput"><span class="keyword">double</span></code>-promotion
122 policies differ from the defaults.
123 </p>
124 </div>
125 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
126 <td align="left"></td>
127 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
128 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
129 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
130 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
131 Distributed under the Boost Software License, Version 1.0. (See accompanying
132 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>)
133 </p>
134 </div></td>
135 </tr></table>
136 <hr>
137 <div class="spirit-nav">
138 <a accesskey="p" href="what_is_a_policy.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../pol_tutorial.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="policy_usage.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
139 </div>
140 </body>
141 </html>