• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>enum class safe_numerics_error</title>
5<link rel="stylesheet" href="boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="index.html" title="Safe Numerics">
8<link rel="up" href="exception.html" title="exception">
9<link rel="prev" href="exception.html" title="Description">
10<link rel="next" href="exception.html" title="enum class safe_numerics_actions">
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 href="index.html" height="164px" src="pre-boost.jpg" alt="Library Documentation Index"></td>
15<td><h2>Safe Numerics</h2></td>
16</tr></table>
17<div class="spirit-nav">
18<a accesskey="p" href="exception.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="exception.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="exception.html"><img src="images/next.png" alt="Next"></a>
19</div>
20<div class="section">
21<div class="titlepage"><div><div><h4 class="title">
22<a name="safe_numerics.safe_numerics_error"></a>enum class safe_numerics_error</h4></div></div></div>
23<p>The following values are those which a numeric result might return.
24    They resemble the standard error codes used by C++ standard exceptions.
25    This resemblance is coincidental and they are wholly unrelated to any
26    codes of similar names. The reason for the resemblance is that the library
27    started it's development using the standard library codes. But as
28    development progressed it became clear that the original codes weren't
29    sufficient so now they stand on their own. Here are a list of error codes.
30    The description of what they mean is</p>
31<div class="informaltable"><table class="table">
32<colgroup>
33<col align="left">
34<col align="left">
35</colgroup>
36<thead><tr>
37<th align="left">Symbol</th>
38<th align="left">Description</th>
39</tr></thead>
40<tbody>
41<tr>
42<td align="left"><code class="computeroutput">success</code></td>
43<td align="left">successful operation - no error returned</td>
44</tr>
45<tr>
46<td align="left"><code class="computeroutput">positive_overflow_error</code></td>
47<td align="left">A positive number is too large to be represented by the
48              data type</td>
49</tr>
50<tr>
51<td align="left"><code class="computeroutput">negative_overflow_error</code></td>
52<td align="left">The absolute value of a negative number is too large to
53              be represented by the data type.</td>
54</tr>
55<tr>
56<td align="left"><code class="computeroutput">underflow_error</code></td>
57<td align="left">A number is too close to zero to be represented by the
58              data type.</td>
59</tr>
60<tr>
61<td align="left"><code class="computeroutput">range_error</code></td>
62<td align="left">an argument to a function or operator is outside the
63              legal range - e.g. sqrt(-1).</td>
64</tr>
65<tr>
66<td align="left"><code class="computeroutput">domain_error</code></td>
67<td align="left">the result of an operation is outside the legal range of
68              the result.</td>
69</tr>
70<tr>
71<td align="left"><code class="computeroutput">implementation_defined_behavior</code></td>
72<td align="left">operation may or may not return the expected
73              result.</td>
74</tr>
75<tr>
76<td align="left"><code class="computeroutput">undefined_behavior</code></td>
77<td align="left">According to the C++ standard, the result is undefined.
78              e.g. 10 &lt;&lt; 80 shifts bits off the left and returns an
79              unexpected result of 0 on most machines.</td>
80</tr>
81<tr>
82<td align="left"><code class="computeroutput">uninitialized_value</code></td>
83<td align="left">According to the C++ standard, the result may be defined
84              by the application. e.g. 16 &gt;&gt; 10 will result the expected
85              result of 0 on most machines.</td>
86</tr>
87</tbody>
88</table></div>
89<p>The above listed codes can be transformed to a instance of type
90    <a href="http://en.cppreference.com/w/cpp/error/error_code" target="_top"><code class="computeroutput">std::error_code</code></a>
91    with the function:</p>
92<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">make_error_code</span><span class="special">(</span><span class="identifier">safe_numerics_error</span> <span class="identifier">e</span><span class="special">)</span></pre>
93<p>This object can be</p>
94</div>
95<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
96<td align="left"></td>
97<td align="right"><div class="copyright-footer">Copyright &#169; 2012 Robert Ramey<p><a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost
98      Software License</a></p>
99</div></td>
100</tr></table>
101<hr>
102<div class="spirit-nav">
103<a accesskey="p" href="exception.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="exception.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="exception.html"><img src="images/next.png" alt="Next"></a>
104</div>
105</body>
106</html>
107