1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QuantLib: Rounding Class Reference</title>
<link href='https://fonts.googleapis.com/css?family=Merriweather+Sans:800' rel='stylesheet' type='text/css'>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="quantlibextra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname"><a href="http://quantlib.org">
<img alt="QuantLib" src="QL-title.jpg"></a>
<div id="projectbrief">A free/open-source library for quantitative finance</div>
<div id="projectnumber">Reference manual - version 1.20</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_quant_lib.html">QuantLib</a></li><li class="navelem"><a class="el" href="class_quant_lib_1_1_rounding.html">Rounding</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="class_quant_lib_1_1_rounding-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Rounding Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>basic rounding class
<a href="class_quant_lib_1_1_rounding.html#details">More...</a></p>
<p><code>#include <ql/math/rounding.hpp></code></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for Rounding:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="class_quant_lib_1_1_rounding__inherit__graph.png" border="0" usemap="#a_rounding_inherit__map" alt="Inheritance graph"/></div>
<map name="_rounding_inherit__map" id="a_rounding_inherit__map">
<area shape="rect" title="basic rounding class" alt="" coords="316,5,393,32"/>
<area shape="rect" href="class_quant_lib_1_1_ceiling_truncation.html" title="Ceiling truncation." alt="" coords="5,80,128,107"/>
<area shape="rect" href="class_quant_lib_1_1_closest_rounding.html" title="Closest rounding." alt="" coords="152,80,275,107"/>
<area shape="rect" href="class_quant_lib_1_1_down_rounding.html" title="Down-rounding." alt="" coords="299,80,410,107"/>
<area shape="rect" href="class_quant_lib_1_1_floor_truncation.html" title="Floor truncation." alt="" coords="435,80,547,107"/>
<area shape="rect" href="class_quant_lib_1_1_up_rounding.html" title="Up-rounding." alt="" coords="571,80,666,107"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a1d1cfd8ffb84e947f82999c682b666a7"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7">Type</a> { <br />
  <a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7ac9d3e887722f2bc482bcca9d41c512af">None</a>,
<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7a57a7edcbc04d6175683383cad5c3e0a2">Up</a>,
<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7abcf8c79e9a5f5f9d606fb35645a0fb27">Down</a>,
<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7a32c94a47509871edf49d5c3936689d30">Closest</a>,
<br />
  <a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7a94e95e4b8360855608dfad0b1f43a301">Floor</a>,
<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7a0d419a70fa5708b3735db741f20316c9">Ceiling</a>
<br />
}</td></tr>
<tr class="memdesc:a1d1cfd8ffb84e947f82999c682b666a7"><td class="mdescLeft"> </td><td class="mdescRight">rounding methods <a href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7">More...</a><br /></td></tr>
<tr class="separator:a1d1cfd8ffb84e947f82999c682b666a7"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a935bf504beb13c384b6bf2b57337b60c"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_rounding.html#a935bf504beb13c384b6bf2b57337b60c">Rounding</a> ()</td></tr>
<tr class="memdesc:a935bf504beb13c384b6bf2b57337b60c"><td class="mdescLeft"> </td><td class="mdescRight">default constructor <a href="class_quant_lib_1_1_rounding.html#a935bf504beb13c384b6bf2b57337b60c">More...</a><br /></td></tr>
<tr class="separator:a935bf504beb13c384b6bf2b57337b60c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2a79742b3f2854a95befbd58cf917341"><td class="memItemLeft" align="right" valign="top"><a id="a2a79742b3f2854a95befbd58cf917341"></a>
 </td><td class="memItemRight" valign="bottom"><b>Rounding</b> (<a class="el" href="group__types.html#gab9c87440c314438e51a899a03d2442d0">Integer</a> precision, <a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7">Type</a> type=<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7a32c94a47509871edf49d5c3936689d30">Closest</a>, <a class="el" href="group__types.html#gab9c87440c314438e51a899a03d2442d0">Integer</a> digit=5)</td></tr>
<tr class="separator:a2a79742b3f2854a95befbd58cf917341"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a45ba4c8715758ff99810438b3da81096"><td class="memItemLeft" align="right" valign="top"><a id="a45ba4c8715758ff99810438b3da81096"></a>
<a class="el" href="group__types.html#gaee215f8d421f6afcede0391fcffb5fe7">Decimal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_rounding.html#a45ba4c8715758ff99810438b3da81096">operator()</a> (<a class="el" href="group__types.html#gaee215f8d421f6afcede0391fcffb5fe7">Decimal</a> value) const</td></tr>
<tr class="memdesc:a45ba4c8715758ff99810438b3da81096"><td class="mdescLeft"> </td><td class="mdescRight">perform rounding <br /></td></tr>
<tr class="separator:a45ba4c8715758ff99810438b3da81096"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Inspectors</h2></td></tr>
<tr class="memitem:a8d7b9f60ed359fbcfbf178ca94e441b2"><td class="memItemLeft" align="right" valign="top"><a id="a8d7b9f60ed359fbcfbf178ca94e441b2"></a>
<a class="el" href="group__types.html#gab9c87440c314438e51a899a03d2442d0">Integer</a> </td><td class="memItemRight" valign="bottom"><b>precision</b> () const</td></tr>
<tr class="separator:a8d7b9f60ed359fbcfbf178ca94e441b2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adf4a6727c689e0038cf2cdd158d5ed2c"><td class="memItemLeft" align="right" valign="top"><a id="adf4a6727c689e0038cf2cdd158d5ed2c"></a>
<a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7">Type</a> </td><td class="memItemRight" valign="bottom"><b>type</b> () const</td></tr>
<tr class="separator:adf4a6727c689e0038cf2cdd158d5ed2c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ade608fc4bb3fa264139b624d6453dc30"><td class="memItemLeft" align="right" valign="top"><a id="ade608fc4bb3fa264139b624d6453dc30"></a>
<a class="el" href="group__types.html#gab9c87440c314438e51a899a03d2442d0">Integer</a> </td><td class="memItemRight" valign="bottom"><b>roundingDigit</b> () const</td></tr>
<tr class="separator:ade608fc4bb3fa264139b624d6453dc30"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>basic rounding class </p>
<dl class="test"><dt><b><a class="el" href="test.html#_test000068">Tests:</a></b></dt><dd>the correctness of the returned values is tested by checking them against known good results. </dd></dl>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a id="a1d1cfd8ffb84e947f82999c682b666a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d1cfd8ffb84e947f82999c682b666a7">◆ </a></span>Type</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="class_quant_lib_1_1_rounding.html#a1d1cfd8ffb84e947f82999c682b666a7">Type</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>rounding methods </p>
<p>The rounding methods follow the OMG specification available at <a href="http://www.omg.org/cgi-bin/doc?formal/00-06-29.pdf">http://www.omg.org/cgi-bin/doc?formal/00-06-29.pdf</a>.</p>
<dl class="caveats"><dt><b><a class="el" href="caveats.html#_caveats000106">Warning:</a></b></dt><dd>the names of the <a class="el" href="class_quant_lib_1_1_floor.html" title="Concrete floor class.">Floor</a> and Ceiling methods might be misleading. Check the provided reference. </dd></dl>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7ac9d3e887722f2bc482bcca9d41c512af"></a>None </td><td class="fielddoc"><p>do not round: return the number unmodified </p>
</td></tr>
<tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7a57a7edcbc04d6175683383cad5c3e0a2"></a>Up </td><td class="fielddoc"><p>the first decimal place past the precision will be rounded up. This differs from the OMG rule which rounds up only if the decimal to be rounded is greater than or equal to the rounding digit </p>
</td></tr>
<tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7abcf8c79e9a5f5f9d606fb35645a0fb27"></a>Down </td><td class="fielddoc"><p>all decimal places past the precision will be truncated </p>
</td></tr>
<tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7a32c94a47509871edf49d5c3936689d30"></a>Closest </td><td class="fielddoc"><p>the first decimal place past the precision will be rounded up if greater than or equal to the rounding digit; this corresponds to the OMG round-up rule. When the rounding digit is 5, the result will be the one closest to the original number, hence the name. </p>
</td></tr>
<tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7a94e95e4b8360855608dfad0b1f43a301"></a>Floor </td><td class="fielddoc"><p>positive numbers will be rounded up and negative numbers will be rounded down using the OMG round up and round down rules </p>
</td></tr>
<tr><td class="fieldname"><a id="a1d1cfd8ffb84e947f82999c682b666a7a0d419a70fa5708b3735db741f20316c9"></a>Ceiling </td><td class="fielddoc"><p>positive numbers will be rounded down and negative numbers will be rounded up using the OMG round up and round down rules </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a935bf504beb13c384b6bf2b57337b60c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a935bf504beb13c384b6bf2b57337b60c">◆ </a></span>Rounding()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_quant_lib_1_1_rounding.html">Rounding</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>default constructor </p>
<p>Instances built through this constructor don't perform any rounding. </p>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="http://www.doxygen.org/index.html">Doxygen</a>
1.8.20
</small></address>
</body>
</html>
|