<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='pmathml.xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Convert From AD to Integer</title>
<meta name="description" id="description" content="Convert From AD to Integer"/>
<meta name="keywords" id="keywords" content=" Integer Ad convert to integer "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_integer_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td><a href="value.cpp.xml" target="_top">Prev</a>
</td><td><a href="integer.cpp.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>CppAD</option>
<option>AD</option>
<option>Convert</option>
<option>Integer</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>CppAD-&gt;</option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>multi_thread</option>
<option>library</option>
<option>cppad_ipopt_nlp</option>
<option>Example</option>
<option>preprocessor</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>AD-&gt;</option>
<option>Default</option>
<option>ad_copy</option>
<option>Convert</option>
<option>ADValued</option>
<option>BoolValued</option>
<option>VecAD</option>
<option>base_require</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>Convert-&gt;</option>
<option>Value</option>
<option>Integer</option>
<option>Output</option>
<option>PrintFor</option>
<option>Var2Par</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>Integer-&gt;</option>
<option>Integer.cpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>i</option>
<option>x</option>
<option>---..Real Types</option>
<option>---..Complex Types</option>
<option>---..AD Types</option>
<option>Operation Sequence</option>
<option>Example</option>
</select>
</td>
</tr></table><br/>








<center><b><big><big>Convert From AD to Integer</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>
<code><font color="blue"></font></code><i><span style='white-space: nowrap'>i</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;Integer(</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'>)</span></font></code>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
Converts from an AD type to the corresponding integer value.

<br/>
<br/>
<b><big><a name="i" id="i">i</a></big></b>
<br/>
The result <i>i</i> has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;int&#xA0;</span></font></code><i><span style='white-space: nowrap'>i</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code><br/>
<b><big><a name="x" id="x">x</a></big></b>


<br/>
<br/>
<b><a name="x.Real Types" id="x.Real Types">Real Types</a></b>
<br/>
If the argument <i>x</i> has either of the following prototypes:
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;float&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font></code><i></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;double&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font></code><i></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>the fractional part is dropped to form the integer value.
For example, if <i>x</i> is 1.5, <i>i</i> is 1.
In general, if 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&#x02265;</mo>
<mn>0</mn>
</mrow></math>

, <i>i</i> is the 
greatest integer less than or equal <i>x</i>.
If 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&#x02264;</mo>
<mn>0</mn>
</mrow></math>

, <i>i</i> is the 
smallest integer greater than or equal <i>x</i>.

<br/>
<br/>
<b><a name="x.Complex Types" id="x.Complex Types">Complex Types</a></b>
<br/>
If the argument <i>x</i> has either of the following prototypes:
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;std::complex&lt;float&gt;&#xA0;&#xA0;</span></font></code><i></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;std::complex&lt;double&gt;&#xA0;</span></font></code><i></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>The result <i>i</i> is given by
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font></code><i><span style='white-space: nowrap'>i</span></i><code><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;Integer(</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'>.real())<br/>
</span></font></code><br/>
<b><a name="x.AD Types" id="x.AD Types">AD Types</a></b>
<br/>
If the argument <i>x</i> has either of the following prototypes:
<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;AD&lt;</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>&gt;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;VecAD&lt;</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>&gt;::reference&#xA0;&amp;</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code><i>Base</i> must support the <code><font color="blue">Integer</font></code> function and
the conversion has the same meaning as for <i>Base</i>.

<br/>
<br/>
<b><big><a name="Operation Sequence" id="Operation Sequence">Operation Sequence</a></big></b>
<br/>
The result of this operation is not an
<a href="glossary.xml#AD of Base" target="_top"><span style='white-space: nowrap'>AD&#xA0;of&#xA0;Base</span></a>
 object.
Thus it will not be recorded as part of an
AD of <i>Base</i>
<a href="glossary.xml#Operation.Sequence" target="_top"><span style='white-space: nowrap'>operation&#xA0;sequence</span></a>
.

<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>

<br/>
The file
<a href="integer.cpp.xml" target="_top"><span style='white-space: nowrap'>Integer.cpp</span></a>

contains an example and test of this operation.


<hr/>Input File: cppad/local/integer.hpp

</body>
</html>

