003 File Manager
Current Path:
/usr/local/share/doc/mpdecimal/libmpdec++
usr
/
local
/
share
/
doc
/
mpdecimal
/
libmpdec++
/
π
..
π
README.txt
(88 B)
π
_static
π
constants.html
(11.82 KB)
π
context.html
(21.78 KB)
π
decimal.html
(121.08 KB)
π
exceptions.html
(12 KB)
π
index.html
(8.71 KB)
π
objects.inv
(2.55 KB)
π
search.html
(2.76 KB)
π
searchindex.js
(26.02 KB)
Editing: decimal.html
<!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="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta content="index,follow" name="robots" /> <meta content="libmpdec++ documentation" name="description" /> <title>Decimal class — mpdecimal 2.5.1 documentation</title> <link rel="stylesheet" href="_static/mpdecimal-doc.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script src="_static/jquery.js"></script> <script src="_static/underscore.js"></script> <script src="_static/doctools.js"></script> <script src="_static/language_data.js"></script> <link rel="search" title="Search" href="search.html" /> <link rel="prev" title="Context" href="context.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="context.html" title="Context" accesskey="P">previous</a></li> <li><a href="http://www.bytereef.org/mpdecimal/index.html">project home</a></li> </ul> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Decimal class</a><ul> <li><a class="reference internal" href="#exact-constructors">Exact constructors</a></li> <li><a class="reference internal" href="#inexact-constructors">Inexact constructors</a></li> <li><a class="reference internal" href="#accessors">Accessors</a></li> <li><a class="reference internal" href="#exact-assignment-operators">Exact assignment operators</a></li> <li><a class="reference internal" href="#inexact-assignment-operators">Inexact assignment operators</a></li> <li><a class="reference internal" href="#exact-comparison-operators">Exact comparison operators</a></li> <li><a class="reference internal" href="#exact-reverse-comparison-operators">Exact reverse comparison operators</a></li> <li><a class="reference internal" href="#unary-arithmetic-operators">Unary arithmetic operators</a></li> <li><a class="reference internal" href="#binary-arithmetic-operators">Binary arithmetic operators</a></li> <li><a class="reference internal" href="#reverse-binary-arithmetic-operators">Reverse binary arithmetic operators</a></li> <li><a class="reference internal" href="#predicates">Predicates</a></li> <li><a class="reference internal" href="#predicates-with-an-optional-context-argument">Predicates with an optional context argument</a></li> <li><a class="reference internal" href="#unary-functions-no-context-argument">Unary functions, no context argument</a></li> <li><a class="reference internal" href="#unary-functions-optional-context-argument">Unary functions, optional context argument</a></li> <li><a class="reference internal" href="#binary-functions-no-context-argument">Binary functions, no context argument</a></li> <li><a class="reference internal" href="#binary-functions-optional-context-argument">Binary functions, optional context argument</a></li> <li><a class="reference internal" href="#binary-functions-two-return-values">Binary functions, two return values</a></li> <li><a class="reference internal" href="#ternary-functions">Ternary functions</a></li> <li><a class="reference internal" href="#irregular-functions">Irregular functions</a></li> <li><a class="reference internal" href="#exact-integer-conversion">Exact integer conversion</a></li> <li><a class="reference internal" href="#exact-triple-conversion">Exact triple conversion</a></li> <li><a class="reference internal" href="#exact-string-conversion">Exact string conversion</a></li> <li><a class="reference internal" href="#inexact-string-conversion">Inexact string conversion</a></li> <li><a class="reference internal" href="#streams">Streams</a></li> <li><a class="reference internal" href="#required-by-the-specification">Required by the specification</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="context.html" title="previous chapter">Context</a></p> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="decimal-class"> <h1>Decimal class</h1> <div class="section" id="exact-constructors"> <h2>Exact constructors</h2> <dl class="class"> <dt id="_CPPv4N7decimal7DecimalE"> <span id="_CPPv3N7decimal7DecimalE"></span><span id="_CPPv2N7decimal7DecimalE"></span><span id="decimal::Decimal"></span><em class="property">class </em><code class="descname">Decimal</code><br /></dt> <dd><dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalEv"> <span id="_CPPv3N7decimal7Decimal7DecimalEv"></span><span id="_CPPv2N7decimal7Decimal7DecimalEv"></span><span id="decimal::Decimal::Decimal"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt> <dd><p>Default constructor. The value is initialized to a signaling <cite>NaN</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalERK7Decimal"> <span id="_CPPv3N7decimal7Decimal7DecimalERK7Decimal"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK7Decimal"></span><span id="decimal::Decimal::Decimal__DecimalCR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7Decimal7DecimalEv" title="decimal::Decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact construction by copying the argument.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalERRK7Decimal"> <span id="_CPPv3N7decimal7Decimal7DecimalERRK7Decimal"></span><span id="_CPPv2N7decimal7Decimal7DecimalERRK7Decimal"></span><span id="decimal::Decimal::Decimal__DecimalCRR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7Decimal7DecimalEv" title="decimal::Decimal::Decimal">Decimal</a> &&<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact construction by moving the argument. The argument is reset to a signaling <cite>NaN</cite>, so it is still in a valid state.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalERK1T"> <span id="_CPPv3N7decimal7Decimal7DecimalERK1T"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK1T"></span><span id="decimal::Decimal::Decimal__TCR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact integer conversions. <cite>T</cite> is one of:</p> <blockquote> <div><table border="1" class="docutils align-default"> <colgroup> <col width="41%" /> <col width="59%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><cite>int8_t</cite></td> <td><cite>uint8_t</cite></td> </tr> <tr class="row-even"><td><cite>int16_t</cite></td> <td><cite>uint16_t</cite></td> </tr> <tr class="row-odd"><td><cite>int32_t</cite></td> <td><cite>uint32_t</cite></td> </tr> <tr class="row-even"><td><cite>int64_t</cite></td> <td><cite>uint64_t</cite></td> </tr> <tr class="row-odd"><td><cite>signed char</cite></td> <td><cite>unsigned char</cite></td> </tr> <tr class="row-even"><td><cite>short</cite></td> <td><cite>unsigned short</cite></td> </tr> <tr class="row-odd"><td><cite>int</cite></td> <td><cite>unsigned int</cite></td> </tr> <tr class="row-even"><td><cite>long</cite></td> <td><cite>unsigned long</cite></td> </tr> <tr class="row-odd"><td><cite>long long</cite></td> <td><cite>unsigned long long</cite></td> </tr> </tbody> </table> </div></blockquote> <p>Since construction is always exact, it is safe to allow implicit conversions.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalEPCKc"> <span id="_CPPv3N7decimal7Decimal7DecimalEPCKc"></span><span id="_CPPv2N7decimal7Decimal7DecimalEPCKc"></span><span id="decimal::Decimal::Decimal__cCPC"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact conversion from a <cite>C</cite> string. If an internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p> <p>Raises <cite>ValueError</cite> if the argument is <cite>NULL</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalERKNSt6stringE"> <span id="_CPPv3N7decimal7Decimal7DecimalERKNSt6stringE"></span><span id="_CPPv2N7decimal7Decimal7DecimalERKNSt6stringE"></span><span id="decimal::Decimal::Decimal__ssCR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> std::string &<em>s</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact conversion from a <cite>std::string</cite>. If an internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t"> <span id="_CPPv3N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t"></span><span id="decimal::Decimal::Decimal__mpd_uint128_triple_tCR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> mpd_uint128_triple_t &<em>triple</em><span class="sig-paren">)</span><br /></dt> <dd><p>Exact conversion from an <cite>mpd_uint128_triple_t</cite>. The triple can represent Decimals with a coefficient up to 38 decimal digits. Refer to the <cite>libmpdec</cite> documentation for details (See: <cite>mpd_from_uint128_triple</cite>).</p> <p>Raises <cite>InvalidOperation</cite> for invalid input and <cite>MemoryError</cite> for allocation failures.</p> </dd></dl> </dd></dl> </div> <div class="section" id="inexact-constructors"> <h2>Inexact constructors</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimal7DecimalERK7DecimalR7Context"> <span id="_CPPv3N7decimal7DecimalERK7DecimalR7Context"></span><span id="_CPPv2N7decimal7DecimalERK7DecimalR7Context"></span><span id="decimal::Decimal__DecimalCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>Inexact construction according to the context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7DecimalERK1TR7Context"> <span id="_CPPv3N7decimal7DecimalERK1TR7Context"></span><span id="_CPPv2N7decimal7DecimalERK1TR7Context"></span><span id="decimal::Decimal__TCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>Inexact integer conversions according to the context. <cite>T</cite> is one of:</p> <blockquote> <div><table border="1" class="docutils align-default"> <colgroup> <col width="41%" /> <col width="59%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><cite>int8_t</cite></td> <td><cite>uint8_t</cite></td> </tr> <tr class="row-even"><td><cite>int16_t</cite></td> <td><cite>uint16_t</cite></td> </tr> <tr class="row-odd"><td><cite>int32_t</cite></td> <td><cite>uint32_t</cite></td> </tr> <tr class="row-even"><td><cite>int64_t</cite></td> <td><cite>uint64_t</cite></td> </tr> <tr class="row-odd"><td><cite>signed char</cite></td> <td><cite>unsigned char</cite></td> </tr> <tr class="row-even"><td><cite>short</cite></td> <td><cite>unsigned short</cite></td> </tr> <tr class="row-odd"><td><cite>int</cite></td> <td><cite>unsigned int</cite></td> </tr> <tr class="row-even"><td><cite>long</cite></td> <td><cite>unsigned long</cite></td> </tr> <tr class="row-odd"><td><cite>long long</cite></td> <td><cite>unsigned long long</cite></td> </tr> </tbody> </table> </div></blockquote> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7DecimalEPCKcR7Context"> <span id="_CPPv3N7decimal7DecimalEPCKcR7Context"></span><span id="_CPPv2N7decimal7DecimalEPCKcR7Context"></span><span id="decimal::Decimal__cCPC.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>Inexact conversion from a <cite>C</cite> string according to the context. If an internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p> <p>Raises <cite>ValueError</cite> if the argument is <cite>NULL</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal7DecimalERKNSt6stringER7Context"> <span id="_CPPv3N7decimal7DecimalERKNSt6stringER7Context"></span><span id="_CPPv2N7decimal7DecimalERKNSt6stringER7Context"></span><span id="decimal::Decimal__ssCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> std::string &<em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>Inexact conversion from a <cite>std::string</cite> according to the context. If an internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="accessors"> <h2>Accessors</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimal3getEv"> <span id="_CPPv3N7decimal3getEv"></span><span id="_CPPv2N7decimal3getEv"></span><span id="decimal::get"></span>mpd_t *<code class="descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt> <dd><p>Return a pointer to the private <cite>mpd_t</cite>. This should only be used for passing a Decimalβs internal value to <cite>libmpdec</cite> functions, where the Decimal is in the output position.</p> <p>This is an advanced function that is not necessary for normal use.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8getconstEv"> <span id="_CPPv3NK7decimal8getconstEv"></span><span id="_CPPv2NK7decimal8getconstEv"></span><span id="decimal::getconstC"></span><em class="property">const</em> mpd_t *<code class="descname">getconst</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a const pointer to the private <cite>mpd_t</cite>. This should only be used for passing a Decimalβs internal value to <cite>libmpdec</cite> functions, where the Decimal is in the input position.</p> <p>This is an advanced function that is not necessary for normal use.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4signEv"> <span id="_CPPv3NK7decimal4signEv"></span><span id="_CPPv2NK7decimal4signEv"></span><span id="decimal::signC"></span>int <code class="descname">sign</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the arithmetic sign of the Decimal: <cite>1</cite> for positive values, <cite>-1</cite> for negative values.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5coeffEv"> <span id="_CPPv3NK7decimal5coeffEv"></span><span id="_CPPv2NK7decimal5coeffEv"></span><span id="decimal::coeffC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">coeff</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the coefficient of the Decimal. If the Decimal is a special value, raise <cite>ValueError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8exponentEv"> <span id="_CPPv3NK7decimal8exponentEv"></span><span id="_CPPv2NK7decimal8exponentEv"></span><span id="decimal::exponentC"></span>int64_t <code class="descname">exponent</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the exponent of the Decimal. If the Decimal is a special value, raise <cite>ValueError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7payloadEv"> <span id="_CPPv3NK7decimal7payloadEv"></span><span id="_CPPv2NK7decimal7payloadEv"></span><span id="decimal::payloadC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">payload</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the <cite>NaN</cite> payload of the Decimal. The default value for <cite>NaNs</cite> without a payload is <cite>0</cite>.</p> <p>If the Decimal is not a <cite>NaN</cite>, raise <cite>ValueError</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-assignment-operators"> <h2>Exact assignment operators</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimalaSERK7Decimal"> <span id="_CPPv3N7decimalaSERK7Decimal"></span><span id="_CPPv2N7decimalaSERK7Decimal"></span><span id="decimal::assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>Make an exact copy of the argument. This function can raise <cite>MallocError</cite> if <cite>self</cite> is an arbitrary precision Decimal with a very large coefficient. In practice this does not occur with regular context precisions from 9 to 38 digits.</p> <p>Copying has a strong exception guarantee, so the lvalue is unchanged in case of <cite>MallocError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalaSERR7Decimal"> <span id="_CPPv3N7decimalaSERR7Decimal"></span><span id="_CPPv2N7decimalaSERR7Decimal"></span><span id="decimal::assign-operator__DecimalRR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator=</code><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &&<em>other</em><span class="sig-paren">)</span> <em class="property">noexcept</em><br /></dt> <dd><p>Move the argument. The argument is reset to <cite>sNaN</cite> and is still in a valid state.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="inexact-assignment-operators"> <h2>Inexact assignment operators</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimalpLERK7Decimal"> <span id="_CPPv3N7decimalpLERK7Decimal"></span><span id="_CPPv2N7decimalpLERK7Decimal"></span><span id="decimal::add-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator+=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>In-place add. Uses the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalmIERK7Decimal"> <span id="_CPPv3N7decimalmIERK7Decimal"></span><span id="_CPPv2N7decimalmIERK7Decimal"></span><span id="decimal::sub-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator-=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>In-place subtract. Uses the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalmLERK7Decimal"> <span id="_CPPv3N7decimalmLERK7Decimal"></span><span id="_CPPv2N7decimalmLERK7Decimal"></span><span id="decimal::mul-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator*=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>In-place multiply. Uses the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimaldVERK7Decimal"> <span id="_CPPv3N7decimaldVERK7Decimal"></span><span id="_CPPv2N7decimaldVERK7Decimal"></span><span id="decimal::div-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator/=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>In-place divide. Uses the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalrMERK7Decimal"> <span id="_CPPv3N7decimalrMERK7Decimal"></span><span id="_CPPv2N7decimalrMERK7Decimal"></span><span id="decimal::mod-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<code class="descname">operator%=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span><br /></dt> <dd><p>In-place remainder. Uses the thread local context.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-comparison-operators"> <h2>Exact comparison operators</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimaleqERK7Decimal"> <span id="_CPPv3NK7decimaleqERK7Decimal"></span><span id="_CPPv2NK7decimaleqERK7Decimal"></span><span id="decimal::eq-operator__DecimalCRC"></span>bool <code class="descname">operator==</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if the values are exactly equal. Infinities compare equal if the signs are equal. Quiet <cite>NaNs</cite> are not equal to anything else (including quiet <cite>NaNs</cite>).</p> <p>Signaling <cite>NaNs</cite> set <cite>InvalidOperation</cite>, using the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalneERK7Decimal"> <span id="_CPPv3NK7decimalneERK7Decimal"></span><span id="_CPPv2NK7decimalneERK7Decimal"></span><span id="decimal::neq-operator__DecimalCRC"></span>bool <code class="descname">operator!=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if the values are not equal. The above rules apply (adapted for <cite>!=</cite>).</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalltERK7Decimal"> <span id="_CPPv3NK7decimalltERK7Decimal"></span><span id="_CPPv2NK7decimalltERK7Decimal"></span><span id="decimal::lt-operator__DecimalCRC"></span>bool <code class="descname">operator<</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if <cite>self < other</cite>. In the case of ordering comparisons quiet <cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalleERK7Decimal"> <span id="_CPPv3NK7decimalleERK7Decimal"></span><span id="_CPPv2NK7decimalleERK7Decimal"></span><span id="decimal::lte-operator__DecimalCRC"></span>bool <code class="descname">operator<=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if <cite>self <= other</cite>. In the case of ordering comparisons quiet <cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalgeERK7Decimal"> <span id="_CPPv3NK7decimalgeERK7Decimal"></span><span id="_CPPv2NK7decimalgeERK7Decimal"></span><span id="decimal::gte-operator__DecimalCRC"></span>bool <code class="descname">operator>=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if <cite>self >= other</cite>. In the case of ordering comparisons quiet <cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalgtERK7Decimal"> <span id="_CPPv3NK7decimalgtERK7Decimal"></span><span id="_CPPv2NK7decimalgtERK7Decimal"></span><span id="decimal::gt-operator__DecimalCRC"></span>bool <code class="descname">operator></code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine if <cite>self > other</cite>. In the case of ordering comparisons quiet <cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-reverse-comparison-operators"> <h2>Exact reverse comparison operators</h2> <blockquote> <div><p>Reverse comparison operators. <cite>T</cite> is one of:</p> <blockquote> <div><table border="1" class="docutils align-default"> <colgroup> <col width="41%" /> <col width="59%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><cite>int8_t</cite></td> <td><cite>uint8_t</cite></td> </tr> <tr class="row-even"><td><cite>int16_t</cite></td> <td><cite>uint16_t</cite></td> </tr> <tr class="row-odd"><td><cite>int32_t</cite></td> <td><cite>uint32_t</cite></td> </tr> <tr class="row-even"><td><cite>int64_t</cite></td> <td><cite>uint64_t</cite></td> </tr> <tr class="row-odd"><td><cite>signed char</cite></td> <td><cite>unsigned char</cite></td> </tr> <tr class="row-even"><td><cite>short</cite></td> <td><cite>unsigned short</cite></td> </tr> <tr class="row-odd"><td><cite>int</cite></td> <td><cite>unsigned int</cite></td> </tr> <tr class="row-even"><td><cite>long</cite></td> <td><cite>unsigned long</cite></td> </tr> <tr class="row-odd"><td><cite>long long</cite></td> <td><cite>unsigned long long</cite></td> </tr> </tbody> </table> </div></blockquote> <dl class="function"> <dt id="_CPPv4N7decimaleqERK1TRK7Decimal"> <span id="_CPPv3N7decimaleqERK1TRK7Decimal"></span><span id="_CPPv2N7decimaleqERK1TRK7Decimal"></span><span id="decimal::eq-operator__TCR.DecimalCR"></span>bool <code class="descname">operator==</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalneERK1TRK7Decimal"> <span id="_CPPv3N7decimalneERK1TRK7Decimal"></span><span id="_CPPv2N7decimalneERK1TRK7Decimal"></span><span id="decimal::neq-operator__TCR.DecimalCR"></span>bool <code class="descname">operator!=</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalltERK1TRK7Decimal"> <span id="_CPPv3N7decimalltERK1TRK7Decimal"></span><span id="_CPPv2N7decimalltERK1TRK7Decimal"></span><span id="decimal::lt-operator__TCR.DecimalCR"></span>bool <code class="descname">operator<</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalleERK1TRK7Decimal"> <span id="_CPPv3N7decimalleERK1TRK7Decimal"></span><span id="_CPPv2N7decimalleERK1TRK7Decimal"></span><span id="decimal::lte-operator__TCR.DecimalCR"></span>bool <code class="descname">operator<=</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalgeERK1TRK7Decimal"> <span id="_CPPv3N7decimalgeERK1TRK7Decimal"></span><span id="_CPPv2N7decimalgeERK1TRK7Decimal"></span><span id="decimal::gte-operator__TCR.DecimalCR"></span>bool <code class="descname">operator>=</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalgtERK1TRK7Decimal"> <span id="_CPPv3N7decimalgtERK1TRK7Decimal"></span><span id="_CPPv2N7decimalgtERK1TRK7Decimal"></span><span id="decimal::gt-operator__TCR.DecimalCR"></span>bool <code class="descname">operator></code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> </div></blockquote> </div> <div class="section" id="unary-arithmetic-operators"> <h2>Unary arithmetic operators</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimalmiEv"> <span id="_CPPv3NK7decimalmiEv"></span><span id="_CPPv2NK7decimalmiEv"></span><span id="decimal::sub-operatorC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Negate the input operand. This function is equivalent to <cite>Decimal.minus</cite> and applies the thread local context. Note that positive zeros keep their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalplEv"> <span id="_CPPv3NK7decimalplEv"></span><span id="_CPPv2NK7decimalplEv"></span><span id="decimal::add-operatorC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the input operand after applying the thread local context. This function is equivalent to <cite>Decimal.plus</cite>. Note that negative zeros lose their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="binary-arithmetic-operators"> <h2>Binary arithmetic operators</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimalplERK7Decimal"> <span id="_CPPv3NK7decimalplERK7Decimal"></span><span id="_CPPv2NK7decimalplERK7Decimal"></span><span id="decimal::add-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self + other</cite>. The operation is performed on the unrounded input operands and has a single final rounding step. The thread local context is used.</p> <p>Same as <cite>self.add(other, context)</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalmiERK7Decimal"> <span id="_CPPv3NK7decimalmiERK7Decimal"></span><span id="_CPPv2NK7decimalmiERK7Decimal"></span><span id="decimal::sub-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self - other</cite>. The operation is performed on the unrounded input operands and has a single final rounding step. The thread local context is used.</p> <p>Same as <cite>self.sub(other, context)</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalmlERK7Decimal"> <span id="_CPPv3NK7decimalmlERK7Decimal"></span><span id="_CPPv2NK7decimalmlERK7Decimal"></span><span id="decimal::mul-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator*</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self * other</cite>. The operation is performed on the unrounded input operands and has a single final rounding step. The thread local context is used.</p> <p>Same as <cite>self.mul(other, context)</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimaldvERK7Decimal"> <span id="_CPPv3NK7decimaldvERK7Decimal"></span><span id="_CPPv2NK7decimaldvERK7Decimal"></span><span id="decimal::div-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator/</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self / other</cite>. The operation is performed on the unrounded input operands and has a single final rounding step. The thread local context is used.</p> <p>Same as <cite>self.div(other, context)</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimalrmERK7Decimal"> <span id="_CPPv3NK7decimalrmERK7Decimal"></span><span id="_CPPv2NK7decimalrmERK7Decimal"></span><span id="decimal::mod-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator%</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self % other</cite>. The operation is performed on the unrounded input operands and has a single final rounding step. The thread local context is used.</p> <p>Same as <cite>self.rem(other, context)</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="reverse-binary-arithmetic-operators"> <h2>Reverse binary arithmetic operators</h2> <blockquote> <div><p>Reverse binary arithmetic operators. <cite>T</cite> is one of:</p> <blockquote> <div><table border="1" class="docutils align-default"> <colgroup> <col width="41%" /> <col width="59%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><cite>int8_t</cite></td> <td><cite>uint8_t</cite></td> </tr> <tr class="row-even"><td><cite>int16_t</cite></td> <td><cite>uint16_t</cite></td> </tr> <tr class="row-odd"><td><cite>int32_t</cite></td> <td><cite>uint32_t</cite></td> </tr> <tr class="row-even"><td><cite>int64_t</cite></td> <td><cite>uint64_t</cite></td> </tr> <tr class="row-odd"><td><cite>signed char</cite></td> <td><cite>unsigned char</cite></td> </tr> <tr class="row-even"><td><cite>short</cite></td> <td><cite>unsigned short</cite></td> </tr> <tr class="row-odd"><td><cite>int</cite></td> <td><cite>unsigned int</cite></td> </tr> <tr class="row-even"><td><cite>long</cite></td> <td><cite>unsigned long</cite></td> </tr> <tr class="row-odd"><td><cite>long long</cite></td> <td><cite>unsigned long long</cite></td> </tr> </tbody> </table> </div></blockquote> <dl class="function"> <dt id="_CPPv4N7decimalplERK1TRK7Decimal"> <span id="_CPPv3N7decimalplERK1TRK7Decimal"></span><span id="_CPPv2N7decimalplERK1TRK7Decimal"></span><span id="decimal::add-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalmiERK1TRK7Decimal"> <span id="_CPPv3N7decimalmiERK1TRK7Decimal"></span><span id="_CPPv2N7decimalmiERK1TRK7Decimal"></span><span id="decimal::sub-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalmlERK1TRK7Decimal"> <span id="_CPPv3N7decimalmlERK1TRK7Decimal"></span><span id="_CPPv2N7decimalmlERK1TRK7Decimal"></span><span id="decimal::mul-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator*</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimaldvERK1TRK7Decimal"> <span id="_CPPv3N7decimaldvERK1TRK7Decimal"></span><span id="_CPPv2N7decimaldvERK1TRK7Decimal"></span><span id="decimal::div-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator/</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> <dl class="function"> <dt id="_CPPv4N7decimalrmERK1TRK7Decimal"> <span id="_CPPv3N7decimalrmERK1TRK7Decimal"></span><span id="_CPPv2N7decimalrmERK1TRK7Decimal"></span><span id="decimal::mod-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator%</code><span class="sig-paren">(</span><em class="property">const</em> T &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd></dd></dl> </div></blockquote> </div> <div class="section" id="predicates"> <h2>Predicates</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal8isfiniteEv"> <span id="_CPPv3NK7decimal8isfiniteEv"></span><span id="_CPPv2NK7decimal8isfiniteEv"></span><span id="decimal::isfiniteC"></span>bool <code class="descname">isfinite</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a finite number, and <cite>false</cite> if <cite>self</cite> is infinite or a quiet or signaling <cite>NaN</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal10isinfiniteEv"> <span id="_CPPv3NK7decimal10isinfiniteEv"></span><span id="_CPPv2NK7decimal10isinfiniteEv"></span><span id="decimal::isinfiniteC"></span>bool <code class="descname">isinfinite</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is either a positive or negative infinity and <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9isspecialEv"> <span id="_CPPv3NK7decimal9isspecialEv"></span><span id="_CPPv2NK7decimal9isspecialEv"></span><span id="decimal::isspecialC"></span>bool <code class="descname">isspecial</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return true if <cite>self</cite> is a quiet or signaling <cite>NaN</cite> or infinite, <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5isnanEv"> <span id="_CPPv3NK7decimal5isnanEv"></span><span id="_CPPv2NK7decimal5isnanEv"></span><span id="decimal::isnanC"></span>bool <code class="descname">isnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a quiet or signaling <cite>NaN</cite> and <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6isqnanEv"> <span id="_CPPv3NK7decimal6isqnanEv"></span><span id="_CPPv2NK7decimal6isqnanEv"></span><span id="decimal::isqnanC"></span>bool <code class="descname">isqnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a quiet <cite>NaN</cite>, and <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6issnanEv"> <span id="_CPPv3NK7decimal6issnanEv"></span><span id="_CPPv2NK7decimal6issnanEv"></span><span id="decimal::issnanC"></span>bool <code class="descname">issnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a signaling <cite>NaN</cite> and <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8issignedEv"> <span id="_CPPv3NK7decimal8issignedEv"></span><span id="_CPPv2NK7decimal8issignedEv"></span><span id="decimal::issignedC"></span>bool <code class="descname">issigned</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> has a negative sign and <cite>false</cite> otherwise. Note that both zeros and <cite>NaNs</cite> can carry signs.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6iszeroEv"> <span id="_CPPv3NK7decimal6iszeroEv"></span><span id="_CPPv2NK7decimal6iszeroEv"></span><span id="decimal::iszeroC"></span>bool <code class="descname">iszero</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a positive or negative zero, <cite>false</cite> otherwise.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9isintegerEv"> <span id="_CPPv3NK7decimal9isintegerEv"></span><span id="_CPPv2NK7decimal9isintegerEv"></span><span id="decimal::isintegerC"></span>bool <code class="descname">isinteger</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Determine whether <cite>self</cite> is an integer. The exponent of an integer is not necessarily zero and may be negative if the coefficient has trailing zeros.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="predicates-with-an-optional-context-argument"> <h2>Predicates with an optional context argument</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimal8isnormalERK7Context"> <span id="_CPPv3N7decimal8isnormalERK7Context"></span><span id="_CPPv2N7decimal8isnormalERK7Context"></span><span id="decimal::isnormal__ContextCR"></span>bool <code class="descname">isnormal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is a normal finite non-zero number with an adjusted exponent greater than or equal to <cite>emin</cite>. Return <cite>false</cite> if <cite>self</cite> is zero, subnormal, infinite or a quiet or signaling <cite>NaN</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal11issubnormalERK7Context"> <span id="_CPPv3N7decimal11issubnormalERK7Context"></span><span id="_CPPv2N7decimal11issubnormalERK7Context"></span><span id="decimal::issubnormal__ContextCR"></span>bool <code class="descname">issubnormal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span><br /></dt> <dd><p>Return <cite>true</cite> if <cite>self</cite> is subnormal, and <cite>false</cite> otherwise. A number is subnormal if it is non-zero, finite, and has an adjusted exponent less than <cite>emin</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="unary-functions-no-context-argument"> <h2>Unary functions, no context argument</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal6adjexpEv"> <span id="_CPPv3NK7decimal6adjexpEv"></span><span id="_CPPv2NK7decimal6adjexpEv"></span><span id="decimal::adjexpC"></span>int64_t <code class="descname">adjexp</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the adjusted exponent of <cite>self</cite>. Defined as exp + digits - 1. Raises <cite>ValueError</cite> for special values.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8copy_absEv"> <span id="_CPPv3NK7decimal8copy_absEv"></span><span id="_CPPv2NK7decimal8copy_absEv"></span><span id="decimal::copy_absC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_abs</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return an exact copy of the absolute value of <cite>self</cite>. In contrast to <cite>Decimal.abs</cite>, this function does not use the thread local context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal11copy_negateEv"> <span id="_CPPv3NK7decimal11copy_negateEv"></span><span id="_CPPv2NK7decimal11copy_negateEv"></span><span id="decimal::copy_negateC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_negate</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return an exact copy of the negation of <cite>self</cite>. In contrast to <cite>-self</cite>, this function does not use the thread local context.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="unary-functions-optional-context-argument"> <h2>Unary functions, optional context argument</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimal12number_classER7Context"> <span id="_CPPv3N7decimal12number_classER7Context"></span><span id="_CPPv2N7decimal12number_classER7Context"></span><span id="decimal::number_class__ContextR"></span>std::string <code class="descname">number_class</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span><br /></dt> <dd><p>Return a string describing the class of the operand. The returned value is one of the following ten strings:</p> <ul class="simple"> <li>β-Infinityβ, indicating that the operand is negative infinity.</li> <li>β-Normalβ, indicating that the operand is a negative normal number.</li> <li>β-Subnormalβ, indicating that the operand is negative and subnormal.</li> <li>β-Zeroβ, indicating that the operand is a negative zero.</li> <li>β+Zeroβ, indicating that the operand is a positive zero.</li> <li>β+Subnormalβ, indicating that the operand is positive and subnormal.</li> <li>β+Normalβ, indicating that the operand is a positive normal number.</li> <li>β+Infinityβ, indicating that the operand is positive infinity.</li> <li>βNaNβ, indicating that the operand is a quiet <cite>NaN</cite> (Not a Number).</li> <li>βsNaNβ, indicating that the operand is a signaling <cite>NaN`</cite>.</li> </ul> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3absER7Context"> <span id="_CPPv3NK7decimal3absER7Context"></span><span id="_CPPv2NK7decimal3absER7Context"></span><span id="decimal::abs__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">abs</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the absolute value of x.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4ceilER7Context"> <span id="_CPPv3NK7decimal4ceilER7Context"></span><span id="_CPPv2NK7decimal4ceilER7Context"></span><span id="decimal::ceil__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ceil</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the ceiling of <cite>self</cite>. Not part of the standard.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3expER7Context"> <span id="_CPPv3NK7decimal3expER7Context"></span><span id="_CPPv2NK7decimal3expER7Context"></span><span id="decimal::exp__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exp</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the value of the exponential function <cite>e**x</cite> at the given number. The function always uses the <cite>ROUND_HALF_EVEN</cite> mode.</p> <p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5floorER7Context"> <span id="_CPPv3NK7decimal5floorER7Context"></span><span id="_CPPv2NK7decimal5floorER7Context"></span><span id="decimal::floor__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">floor</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the floor of <cite>self</cite>. Not part of the standard.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7invrootER7Context"> <span id="_CPPv3NK7decimal7invrootER7Context"></span><span id="_CPPv2NK7decimal7invrootER7Context"></span><span id="decimal::invroot__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">invroot</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the reciprocal of the square root of <cite>self</cite>. The function always uses the <cite>ROUND_HALF_EVEN</cite> mode. Results are not correctly rounded, even if the <cite>allcr</cite> context field is set to 1. This might change in a future release.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal2lnER7Context"> <span id="_CPPv3NK7decimal2lnER7Context"></span><span id="_CPPv2NK7decimal2lnER7Context"></span><span id="decimal::ln__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ln</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the natural (base <cite>e</cite>) logarithm of the operand. The function always uses the <cite>ROUND_HALF_EVEN</cite> mode.</p> <p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5log10ER7Context"> <span id="_CPPv3NK7decimal5log10ER7Context"></span><span id="_CPPv2NK7decimal5log10ER7Context"></span><span id="decimal::log10__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">log10</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the base ten logarithm of the operand. The function always uses the <cite>ROUND_HALF_EVEN</cite> mode.</p> <p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4logbER7Context"> <span id="_CPPv3NK7decimal4logbER7Context"></span><span id="_CPPv2NK7decimal4logbER7Context"></span><span id="decimal::logb__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logb</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>For a non-zero number, return the adjusted exponent of the operand as a Decimal instance. If the operand is a zero, then <cite>Decimal(β-Infinityβ)</cite> is returned and the <cite>DivisionByZero</cite> condition is raised. If the operand is an infinity then <cite>Decimal(βInfinityβ)</cite> is returned.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5minusER7Context"> <span id="_CPPv3NK7decimal5minusER7Context"></span><span id="_CPPv2NK7decimal5minusER7Context"></span><span id="decimal::minus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">minus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Negate the input operand and apply the context. Note that positive zeros keep their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal10next_minusER7Context"> <span id="_CPPv3NK7decimal10next_minusER7Context"></span><span id="_CPPv2NK7decimal10next_minusER7Context"></span><span id="decimal::next_minus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_minus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the largest number representable in the given context that is smaller than the given operand.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9next_plusER7Context"> <span id="_CPPv3NK7decimal9next_plusER7Context"></span><span id="_CPPv2NK7decimal9next_plusER7Context"></span><span id="decimal::next_plus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_plus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the smallest number representable in the given context that is larger than the given operand.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4plusER7Context"> <span id="_CPPv3NK7decimal4plusER7Context"></span><span id="_CPPv2NK7decimal4plusER7Context"></span><span id="decimal::plus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">plus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Copy the input operand and apply the context. Note that negative zeros lose their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6reduceER7Context"> <span id="_CPPv3NK7decimal6reduceER7Context"></span><span id="_CPPv2NK7decimal6reduceER7Context"></span><span id="decimal::reduce__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">reduce</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Normalize the number by stripping the rightmost trailing zeros and converting any result equal to <cite>Decimal(β0β)</cite> to <cite>Decimal(β0e0β)</cite>.</p> <p>Used for producing representative values for members of an equivalence class. For example, Decimal(β32.100β) and Decimal(β0.321000e+2β) both normalize to the equivalent value Decimal(β32.1β).</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal11to_integralER7Context"> <span id="_CPPv3NK7decimal11to_integralER7Context"></span><span id="_CPPv2NK7decimal11to_integralER7Context"></span><span id="decimal::to_integral__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">to_integral</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Round to the nearest integer without signaling Inexact or Rounded. The rounding mode is determined by the by the given context.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal17to_integral_exactER7Context"> <span id="_CPPv3NK7decimal17to_integral_exactER7Context"></span><span id="_CPPv2NK7decimal17to_integral_exactER7Context"></span><span id="decimal::to_integral_exact__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">to_integral_exact</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Round to the nearest integer, signaling <cite>Inexact</cite> or <cite>Rounded</cite> as appropriate if rounding occurs. The rounding mode is determined by the rounding parameter if given, else by the given context. If neither parameter is given, then the rounding mode of the current default context is used.</p> <p>Note that the use of <cite>exact</cite> in this name is determined by the specification and differs from the terminology in <cite>libmpdec++</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4sqrtER7Context"> <span id="_CPPv3NK7decimal4sqrtER7Context"></span><span id="_CPPv2NK7decimal4sqrtER7Context"></span><span id="decimal::sqrt__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">sqrt</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the square root of <cite>self</cite> to context precision. The rounding mode is always <cite>ROUND_HALF_EVEN</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5truncER7Context"> <span id="_CPPv3NK7decimal5truncER7Context"></span><span id="_CPPv2NK7decimal5truncER7Context"></span><span id="decimal::trunc__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">trunc</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self</cite>, truncated towards zero. Not part of the standard.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="binary-functions-no-context-argument"> <h2>Binary functions, no context argument</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal13compare_totalERK7Decimal"> <span id="_CPPv3NK7decimal13compare_totalERK7Decimal"></span><span id="_CPPv2NK7decimal13compare_totalERK7Decimal"></span><span id="decimal::compare_total__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_total</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Compare two operands using their abstract representation rather than their numerical value. Similar to <cite>Decimal.compare</cite>, but the result gives a total ordering on Decimal instances. Two Decimal instances with the same numeric value but different representations compare unequal in this ordering:</p> <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">"12.0"</span><span class="p">).</span><span class="n">compare_total</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">"12"</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">"-1"</span><span class="p">)</span> </pre></div> </div> <p>Quiet and signaling NaNs are also included in the total ordering. The result of this function is Decimal(β0β) if both operands have the same representation, Decimal(β-1β) if the first operand is lower in the total order than the second, and Decimal(β1β) if the first operand is higher in the total order than the second operand. See the specification for details of the total order.</p> <p>This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal17compare_total_magERK7Decimal"> <span id="_CPPv3NK7decimal17compare_total_magERK7Decimal"></span><span id="_CPPv2NK7decimal17compare_total_magERK7Decimal"></span><span id="decimal::compare_total_mag__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_total_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Compare two operands using their abstract representation rather than their value as in <cite>Decimal.compare_total</cite>, but ignoring the sign of each operand.</p> <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">x</span><span class="p">.</span><span class="n">compare_total_mag</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">==</span> <span class="n">x</span><span class="p">.</span><span class="n">copy_abs</span><span class="p">().</span><span class="n">compare_total</span><span class="p">(</span><span class="n">y</span><span class="p">.</span><span class="n">copy_abs</span><span class="p">())</span> </pre></div> </div> <p>This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="binary-functions-optional-context-argument"> <h2>Binary functions, optional context argument</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal3addERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3addERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3addERK7DecimalR7Context"></span><span id="decimal::add__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">add</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the sum of <cite>self</cite> and <cite>other</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3divERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3divERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3divERK7DecimalR7Context"></span><span id="decimal::div__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">div</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self</cite> divided by other.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6divintERK7DecimalR7Context"> <span id="_CPPv3NK7decimal6divintERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6divintERK7DecimalR7Context"></span><span id="decimal::divint__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">divint</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self</cite> divided by <cite>other</cite>, truncated to an integer.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7compareERK7DecimalR7Context"> <span id="_CPPv3NK7decimal7compareERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7compareERK7DecimalR7Context"></span><span id="decimal::compare__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Compare self to other. Return a decimal value:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">a</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">=></span> <span class="n">InvalidOperation</span> <span class="n">a</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"NaN"</span><span class="p">)</span> <span class="n">a</span> <span class="o"><</span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"-1"</span><span class="p">)</span> <span class="n">a</span> <span class="o">==</span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"0"</span><span class="p">)</span> <span class="n">a</span> <span class="o">></span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"1"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal14compare_signalERK7DecimalR7Context"> <span id="_CPPv3NK7decimal14compare_signalERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal14compare_signalERK7DecimalR7Context"></span><span id="decimal::compare_signal__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_signal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Compare self to other. Return a decimal value:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">a</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">=></span> <span class="n">InvalidOperation</span> <span class="n">a</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">=></span> <span class="n">InvalidOperation</span> <span class="n">a</span> <span class="o"><</span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"-1"</span><span class="p">)</span> <span class="n">a</span> <span class="o">==</span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"0"</span><span class="p">)</span> <span class="n">a</span> <span class="o">></span> <span class="n">b</span> <span class="o">=></span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">"1"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3maxERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3maxERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3maxERK7DecimalR7Context"></span><span id="decimal::max__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">max</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Maximum of <cite>self</cite> and <cite>other</cite>. NOTE: If one operand is a quiet <cite>NaN</cite> and the other is numeric, the numeric operand is returned.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7max_magERK7DecimalR7Context"> <span id="_CPPv3NK7decimal7max_magERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7max_magERK7DecimalR7Context"></span><span id="decimal::max_mag__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">max_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Similar to <cite>Decimal.max</cite>, but the comparison is done using the absolute values of the operands.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3minERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3minERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3minERK7DecimalR7Context"></span><span id="decimal::min__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">min</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Minimum of <cite>self</cite> and <cite>other</cite>. NOTE: If one operand is a quiet NaN and the other is numeric, the numeric operand is returned.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7min_magERK7DecimalR7Context"> <span id="_CPPv3NK7decimal7min_magERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7min_magERK7DecimalR7Context"></span><span id="decimal::min_mag__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">min_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Similar to <cite>Decimal.min</cite>, but the comparison is done using the absolute values of the operands.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3mulERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3mulERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3mulERK7DecimalR7Context"></span><span id="decimal::mul__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">mul</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the product of <cite>self</cite> and <cite>other</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal11next_towardERK7DecimalR7Context"> <span id="_CPPv3NK7decimal11next_towardERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11next_towardERK7DecimalR7Context"></span><span id="decimal::next_toward__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_toward</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>If the two operands are unequal, return the number closest to the first operand in the direction of the second operand. If both operands are numerically equal, return a copy of the first operand with the sign set to be the same as the sign of the second operand.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3powERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3powERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3powERK7DecimalR7Context"></span><span id="decimal::pow__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">pow</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Compute <cite>self</cite> raised to the power of <cite>other</cite>. If <cite>self</cite> is negative, then <cite>other</cite> must be integral. The result will be inexact unless <cite>self</cite> is integral and the result is finite and can be expressed exactly in <cite>prec</cite> digits.</p> <p>The result is almost always correctly rounded, but correct rounding is not guaranteed even if <cite>c.allcr()</cite> is set.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8quantizeERK7DecimalR7Context"> <span id="_CPPv3NK7decimal8quantizeERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal8quantizeERK7DecimalR7Context"></span><span id="decimal::quantize__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">quantize</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a value equal to <cite>self</cite> after rounding and having the exponent of the second operand.</p> <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">"1.41421356"</span><span class="p">).</span><span class="n">quantize</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">"1.000"</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">"1.414"</span><span class="p">)</span> </pre></div> </div> <p>Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision, then <cite>InvalidOperation</cite> is set.</p> <p>This guarantees that, unless there is an error condition, the quantized exponent is always equal to that of the right-hand operand.</p> <p>Also unlike other operations, quantize never sets Underflow, even if the result is subnormal and inexact.</p> <p>If the exponent of the second operand is larger than that of the first, then rounding may be necessary. In this case, the rounding mode is determined by the the given context argument.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3remERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3remERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3remERK7DecimalR7Context"></span><span id="decimal::rem__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rem</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>The remainder from the division by <cite>Decimal.divint</cite>. Fails under the same conditions as <cite>Decimal.divint</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal8rem_nearERK7DecimalR7Context"> <span id="_CPPv3NK7decimal8rem_nearERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal8rem_nearERK7DecimalR7Context"></span><span id="decimal::rem_near__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rem_near</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>self - other * n</cite>, where <cite>n</cite> is the integer nearest the exact value of <cite>self / other</cite>. If the result is 0 then its sign will be the sign of <cite>self</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6scalebERK7DecimalR7Context"> <span id="_CPPv3NK7decimal6scalebERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6scalebERK7DecimalR7Context"></span><span id="decimal::scaleb__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">scaleb</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the <cite>self</cite> with the exponent adjusted by the value of <cite>other</cite>. Equivalently, return the first operand multiplied by <cite>10 ** other</cite>. The second operand must be an integer.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3subERK7DecimalR7Context"> <span id="_CPPv3NK7decimal3subERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3subERK7DecimalR7Context"></span><span id="decimal::sub__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">sub</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the difference between <cite>self</cite> and <cite>other</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="binary-functions-two-return-values"> <h2>Binary functions, two return values</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal6divmodERK7DecimalR7Context"> <span id="_CPPv3NK7decimal6divmodERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6divmodERK7DecimalR7Context"></span><span id="decimal::divmod__DecimalCR.ContextRC"></span>std::pair<<a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a>, <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a>> <code class="descname">divmod</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return quotient and remainder of the division <cite>self / other</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="ternary-functions"> <h2>Ternary functions</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal3fmaERK7DecimalRK7DecimalR7Context"> <span id="_CPPv3NK7decimal3fmaERK7DecimalRK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3fmaERK7DecimalRK7DecimalR7Context"></span><span id="decimal::fma__DecimalCR.DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">fma</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>third</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Fused multiply-add. Return <cite>self * other + third</cite> with no rounding of the intermediate product <cite>self * other</cite>.</p> <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="mi">2</span><span class="p">).</span><span class="n">fma</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6powmodERK7DecimalRK7DecimalR7Context"> <span id="_CPPv3NK7decimal6powmodERK7DecimalRK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6powmodERK7DecimalRK7DecimalR7Context"></span><span id="decimal::powmod__DecimalCR.DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">powmod</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>third</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p><cite>self ** other % third</cite>. The following restrictions hold:</p> <ul class="simple"> <li>All three arguments must be integral.</li> <li><cite>other</cite> must be nonnegative.</li> <li>At least one of <cite>self</cite> or <cite>other</cite> must be nonzero.</li> <li><cite>third</cite> must be nonzero and less than <cite>10 ** prec</cite> in absolute value.</li> </ul> </dd></dl> </div></blockquote> </div> <div class="section" id="irregular-functions"> <h2>Irregular functions</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal5applyER7Context"> <span id="_CPPv3NK7decimal5applyER7Context"></span><span id="_CPPv2NK7decimal5applyER7Context"></span><span id="decimal::apply__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">apply</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a copy of <cite>self</cite> with the given context applied. This directly wraps <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">mpd_finalize</span></code>. It is very similar to <cite>Decimal.plus</cite>, but does not have special rules for zeros.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3cmpERK7Decimal"> <span id="_CPPv3NK7decimal3cmpERK7Decimal"></span><span id="_CPPv2NK7decimal3cmpERK7Decimal"></span><span id="decimal::cmp__DecimalCRC"></span>int <code class="descname">cmp</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Same as <cite>Decimal.compare_signal</cite>, but with an integer return value. Return <cite>INT_MAX</cite> if any operand is <cite>NaN</cite>. Not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9cmp_totalERK7Decimal"> <span id="_CPPv3NK7decimal9cmp_totalERK7Decimal"></span><span id="_CPPv2NK7decimal9cmp_totalERK7Decimal"></span><span id="decimal::cmp_total__DecimalCRC"></span>int <code class="descname">cmp_total</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Same as <cite>Decimal.compare_total</cite>, but with an integer return value. Not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal13cmp_total_magERK7Decimal"> <span id="_CPPv3NK7decimal13cmp_total_magERK7Decimal"></span><span id="_CPPv2NK7decimal13cmp_total_magERK7Decimal"></span><span id="decimal::cmp_total_mag__DecimalCRC"></span>int <code class="descname">cmp_total_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Same as <cite>Decimal.compare_total_mag</cite>, but with an integer return value. Not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9copy_signERK7Decimal"> <span id="_CPPv3NK7decimal9copy_signERK7Decimal"></span><span id="_CPPv2NK7decimal9copy_signERK7Decimal"></span><span id="decimal::copy_sign__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_sign</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a copy of the first operand with the sign set to be the same as the sign of the second operand. For example:</p> <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">"2.3"</span><span class="p">).</span><span class="n">copy_sign</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">"-1.5"</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">"-2.3"</span><span class="p">)</span> </pre></div> </div> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal7rescaleEK7int64_tR7Context"> <span id="_CPPv3NK7decimal7rescaleEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal7rescaleEK7int64_tR7Context"></span><span id="decimal::rescale__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rescale</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>exp</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the number that is equal in value to <cite>self</cite>, but has the exponent <cite>exp</cite>. Special numbers are copied without signaling. This function is not part of the standard. It is also not equivalent to the <cite>rescale</cite> function that was removed from the standard.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal12same_quantumERK7Decimal"> <span id="_CPPv3NK7decimal12same_quantumERK7Decimal"></span><span id="_CPPv2NK7decimal12same_quantumERK7Decimal"></span><span id="decimal::same_quantum__DecimalCRC"></span>bool <code class="descname">same_quantum</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Test whether self and other have the same exponent or whether both are <cite>NaN</cite>.</p> <p>This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6shiftlEK7int64_tR7Context"> <span id="_CPPv3NK7decimal6shiftlEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftlEK7int64_tR7Context"></span><span id="decimal::shiftl__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftl</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a copy of <cite>self</cite>, with its coefficient shifted by <cite>n</cite> places to the left. <cite>self</cite> must not be a special number. Digits are never discarded, so the coefficient of the result might exceed <cite>prec</cite>.</p> <p>This function is not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6shiftrEK7int64_tR7Context"> <span id="_CPPv3NK7decimal6shiftrEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftrEK7int64_tR7Context"></span><span id="decimal::shiftr__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftr</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return a copy of <cite>self</cite>, with its coefficient shifted by <cite>n</cite> places to the right.</p> <p>This function is not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal5exactEPCKcR7Context"> <span id="_CPPv3N7decimal5exactEPCKcR7Context"></span><span id="_CPPv2N7decimal5exactEPCKcR7Context"></span><span id="decimal::exact__cCPC.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exact</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>This constructs an exact decimal from a <cite>C</cite> string. The context is only passed for error reporting in case the internal limits are exceeded.</p> <p>This is a convenience function that is rarely used. Not part of the specification.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal5exactERKNSt6stringER7Context"> <span id="_CPPv3N7decimal5exactERKNSt6stringER7Context"></span><span id="_CPPv2N7decimal5exactERKNSt6stringER7Context"></span><span id="decimal::exact__ssCR.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exact</code><span class="sig-paren">(</span><em class="property">const</em> std::string &<em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em><span class="sig-paren">)</span><br /></dt> <dd><p>Same as above, except for the argument type.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal4ln10E7int64_tR7Context"> <span id="_CPPv3N7decimal4ln10E7int64_tR7Context"></span><span id="_CPPv2N7decimal4ln10E7int64_tR7Context"></span><span id="decimal::ln10__int64_t.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ln10</code><span class="sig-paren">(</span>int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span><br /></dt> <dd><p>Compute <cite>ln(10)</cite> to <cite>n</cite> digits of precision. Rounding is always <cite>ROUND_HALF_EVEN</cite>.</p> <p>If <cite>c.allcr()</cite> is set, the result is correctly rounded.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-integer-conversion"> <h2>Exact integer conversion</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal3i64Ev"> <span id="_CPPv3NK7decimal3i64Ev"></span><span id="_CPPv2NK7decimal3i64Ev"></span><span id="decimal::i64C"></span>int64_t <code class="descname">i64</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Convert a Decimal that is exactly representable as an <cite>int64_t</cite>. In case of failure, raise <cite>ValueError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3i32Ev"> <span id="_CPPv3NK7decimal3i32Ev"></span><span id="_CPPv2NK7decimal3i32Ev"></span><span id="decimal::i32C"></span>int32_t <code class="descname">i32</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Convert a Decimal that is exactly representable as an <cite>int32_t</cite>. In case of failure, raise <cite>ValueError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3u64Ev"> <span id="_CPPv3NK7decimal3u64Ev"></span><span id="_CPPv2NK7decimal3u64Ev"></span><span id="decimal::u64C"></span>uint64_t <code class="descname">u64</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Convert a Decimal that is exactly representable as a <cite>uint64_t</cite>. In case of failure, raise <cite>ValueError</cite>.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal3u32Ev"> <span id="_CPPv3NK7decimal3u32Ev"></span><span id="_CPPv2NK7decimal3u32Ev"></span><span id="decimal::u32C"></span>uint32_t <code class="descname">u32</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Convert a Decimal that is exactly representable as a <cite>uint32_t</cite>. In case of failure, raise <cite>ValueError</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-triple-conversion"> <h2>Exact triple conversion</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal17as_uint128_tripleEv"> <span id="_CPPv3NK7decimal17as_uint128_tripleEv"></span><span id="_CPPv2NK7decimal17as_uint128_tripleEv"></span><span id="decimal::as_uint128_tripleC"></span>mpd_uint128_triple_t <code class="descname">as_uint128_triple</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Exact conversion to an <cite>mpd_uint128_triple_t</cite>. The triple can represent Decimals with a coefficient up to 38 decimal digits. Refer to the <cite>libmpdec</cite> documentation for details on how to handle the return value and errors (See: <cite>mpd_as_uint128_triple</cite>).</p> <p>Raises <cite>InvalidOperation</cite> if the coefficient is too large.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="exact-string-conversion"> <h2>Exact string conversion</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal4reprEb"> <span id="_CPPv3NK7decimal4reprEb"></span><span id="_CPPv2NK7decimal4reprEb"></span><span id="decimal::repr__bC"></span>std::string <code class="descname">repr</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Same as <cite>Decimal.to_sci</cite>, but wrap the string in a constructor.</p> <blockquote> <div><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">"1.234E+100"</span><span class="p">).</span><span class="n">repr</span><span class="p">()</span> <span class="o">==</span> <span class="s">"Decimal(</span><span class="se">\"</span><span class="s">1.234E+100</span><span class="se">\"</span><span class="s">)"</span> </pre></div> </div> </div></blockquote> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6to_sciEb"> <span id="_CPPv3NK7decimal6to_sciEb"></span><span id="_CPPv2NK7decimal6to_sciEb"></span><span id="decimal::to_sci__bC"></span>std::string <code class="descname">to_sci</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the scientific string representation of a Decimal. This operation is not context sensitive. If <cite>capitals</cite> is <cite>false</cite>, the exponent character is lower case, otherwise it is upper case.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6to_engEb"> <span id="_CPPv3NK7decimal6to_engEb"></span><span id="_CPPv2NK7decimal6to_engEb"></span><span id="decimal::to_eng__bC"></span>std::string <code class="descname">to_eng</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the engineering string representation of a Decimal. This operation is not context sensitive. If <cite>capitals</cite> is <cite>false</cite>, the exponent character is lower case, otherwise it is upper case.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="inexact-string-conversion"> <h2>Inexact string conversion</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal6formatEPKcRK7Context"> <span id="_CPPv3NK7decimal6formatEPKcRK7Context"></span><span id="_CPPv2NK7decimal6formatEPKcRK7Context"></span><span id="decimal::format__cCP.ContextCRC"></span>std::string <code class="descname">format</code><span class="sig-paren">(</span><em class="property">const</em> char *<em>fmt</em>, <em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the string representation of a decimal according to format string <cite>fmt</cite>. The format string syntax is the same as in Python PEP 3101 (See Standard Format Specifiers) and is quite similar to the syntax used for floating point numbers the C <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">fprintf</span></code> function. The fill character may be a UTF-8 character, the rest of the format string must be ASCII.</p> <p>The function raises <cite>ValueError</cite> for an invalid format string or <cite>MallocError</cite> in case of an allocation failure.</p> <p>If the βnβ format specifier is used, the function calls <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">localeconv</span></code>. Depending on the guarantees of the systemβs <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">localeconv</span></code>, this method may require a lock.</p> <p>All other format specifiers are thread-safe.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6formatERKNSt6stringERK7Context"> <span id="_CPPv3NK7decimal6formatERKNSt6stringERK7Context"></span><span id="_CPPv2NK7decimal6formatERKNSt6stringERK7Context"></span><span id="decimal::format__ssCR.ContextCRC"></span>std::string <code class="descname">format</code><span class="sig-paren">(</span><em class="property">const</em> std::string &<em>s</em>, <em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Same as above, using a string argument.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="streams"> <h2>Streams</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4N7decimallsERNSt7ostreamERK7Decimal"> <span id="_CPPv3N7decimallsERNSt7ostreamERK7Decimal"></span><span id="_CPPv2N7decimallsERNSt7ostreamERK7Decimal"></span><span id="decimal::lshift-operator__osR.DecimalCR"></span><em class="property">friend</em> std::ostream &<code class="descname">operator<<</code><span class="sig-paren">(</span>std::ostream &<em>os</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>self</em><span class="sig-paren">)</span><br /></dt> <dd><p>The conversion uses <cite>Decimal.to_sci</cite>.</p> </dd></dl> </div></blockquote> </div> <div class="section" id="required-by-the-specification"> <h2>Required by the specification</h2> <blockquote> <div><dl class="function"> <dt id="_CPPv4NK7decimal11iscanonicalEv"> <span id="_CPPv3NK7decimal11iscanonicalEv"></span><span id="_CPPv2NK7decimal11iscanonicalEv"></span><span id="decimal::iscanonicalC"></span>bool <code class="descname">iscanonical</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return <cite>true</cite>. This function is required by the specification, and the representation of Decimals is always canonical.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal9canonicalEv"> <span id="_CPPv3NK7decimal9canonicalEv"></span><span id="_CPPv2NK7decimal9canonicalEv"></span><span id="decimal::canonicalC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">canonical</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return an exact copy of <cite>self</cite>. No context is used. Identical to the assignment operator.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal4copyEv"> <span id="_CPPv3NK7decimal4copyEv"></span><span id="_CPPv2NK7decimal4copyEv"></span><span id="decimal::copyC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return an exact copy of <cite>self</cite>. No context is used. Identical to the assignment operator.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal11logical_andERK7DecimalR7Context"> <span id="_CPPv3NK7decimal11logical_andERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11logical_andERK7DecimalR7Context"></span><span id="decimal::logical_and__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_and</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Digit-wise <cite>and</cite> of <cite>self</cite> and <cite>other</cite>. All digits must be 0 or 1.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal14logical_invertER7Context"> <span id="_CPPv3NK7decimal14logical_invertER7Context"></span><span id="_CPPv2NK7decimal14logical_invertER7Context"></span><span id="decimal::logical_invert__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_invert</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Invert the digits of <cite>self</cite>. All digits must be 0 or 1.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal10logical_orERK7DecimalR7Context"> <span id="_CPPv3NK7decimal10logical_orERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal10logical_orERK7DecimalR7Context"></span><span id="decimal::logical_or__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_or</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Digit-wise <cite>or</cite> of <cite>self</cite> and <cite>other</cite>. All digits must be 0 or 1.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal11logical_xorERK7DecimalR7Context"> <span id="_CPPv3NK7decimal11logical_xorERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11logical_xorERK7DecimalR7Context"></span><span id="decimal::logical_xor__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_xor</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Digit-wise <cite>xor</cite> of <cite>self</cite> and <cite>other</cite>. All digits must be 0 or 1.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4N7decimal5radixEv"> <span id="_CPPv3N7decimal5radixEv"></span><span id="_CPPv2N7decimal5radixEv"></span><span id="decimal::radix"></span><em class="property">static</em> int32_t <code class="descname">radix</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt> <dd><p>Return 10.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6rotateERK7DecimalR7Context"> <span id="_CPPv3NK7decimal6rotateERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6rotateERK7DecimalR7Context"></span><span id="decimal::rotate__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rotate</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the result of rotating the digits of the first operand by an amount specified by the second operand. The second operand must be an integer in the range -precision through precision. The absolute value of the second operand gives the number of places to rotate. If the second operand is positive then rotation is to the left; otherwise rotation is to the right The coefficient of the first operand is padded on the left with zeros to length precision if necessary. The sign and exponent of the first operand are unchanged.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal5shiftERK7DecimalR7Context"> <span id="_CPPv3NK7decimal5shiftERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal5shiftERK7DecimalR7Context"></span><span id="decimal::shift__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shift</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Return the result of shifting the digits of the <cite>self</cite> by an amount specified by the <cite>other</cite>. <cite>other</cite> must be an integer in the range <cite>-prec through prec</cite>. The absolute value of the second operand gives the number of places to shift. If <cite>self</cite> is positive, then the shift is to the left; otherwise the shift is to the right. Digits shifted into the coefficient are zeros. The sign and exponent are unchanged.</p> </dd></dl> <dl class="function"> <dt id="_CPPv4NK7decimal6shiftnEK7int64_tR7Context"> <span id="_CPPv3NK7decimal6shiftnEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftnEK7int64_tR7Context"></span><span id="decimal::shiftn__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftn</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt> <dd><p>Like <cite>Decimal.shift</cite>, only that the number of places is specified by a C integer type rather than a decimal. This function is not part of the specification.</p> </dd></dl> </div></blockquote> </div> </div> </div> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="context.html" title="Context" >previous</a></li> <li><a href="http://www.bytereef.org/mpdecimal/index.html">project home</a></li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2020, Stefan Krah. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.4. </div> </body> </html>
Upload File
Create Folder