12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <html lang="en">
- <head>
- <title>mpfr binary operators with a natural operand - avram - a virtual machine code interpreter</title>
- <meta http-equiv="Content-Type" content="text/html">
- <meta name="description" content="avram - a virtual machine code interpreter">
- <meta name="generator" content="makeinfo 4.13">
- <link title="Top" rel="start" href="index.html#Top">
- <link rel="up" href="mpfr.html#mpfr" title="mpfr">
- <link rel="prev" href="mpfr-unary-operators.html#mpfr-unary-operators" title="mpfr unary operators">
- <link rel="next" href="mpfr-binary-predicates.html#mpfr-binary-predicates" title="mpfr binary predicates">
- <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <style type="text/css"><!--
- pre.display { font-family:inherit }
- pre.format { font-family:inherit }
- pre.smalldisplay { font-family:inherit; font-size:smaller }
- pre.smallformat { font-family:inherit; font-size:smaller }
- pre.smallexample { font-size:smaller }
- pre.smalllisp { font-size:smaller }
- span.sc { font-variant:small-caps }
- span.roman { font-family:serif; font-weight:normal; }
- span.sansserif { font-family:sans-serif; font-weight:normal; }
- --></style>
- </head>
- <body>
- <div class="node">
- <a name="mpfr-binary-operators-with-a-natural-operand"></a>
- <p>
- Next: <a rel="next" accesskey="n" href="mpfr-binary-predicates.html#mpfr-binary-predicates">mpfr binary predicates</a>,
- Previous: <a rel="previous" accesskey="p" href="mpfr-unary-operators.html#mpfr-unary-operators">mpfr unary operators</a>,
- Up: <a rel="up" accesskey="u" href="mpfr.html#mpfr">mpfr</a>
- <hr>
- </div>
- <h4 class="subsection">D.14.3 <code>mpfr</code> binary operators with a natural operand</h4>
- <p>Functions with these names take an argument of the form
- <code>(</code><var>x</var><code>,</code><var>n</var><code>)</code>, where <var>x</var> is an <code>mpfr</code> number
- and <var>n</var> is a natural number.
- <ul>
- <li><code>root</code>
- <li><code>pow_ui</code>
- <li><code>mul_2ui</code>
- <li><code>div_2ui</code>
- <li><code>grow</code>
- <li><code>shrink</code>
- </ul>
- <p>The last two are specific to the virtual code interface, having no
- counterpart in the native API of the <code>mpfr</code> library. The
- <code>grow</code> function returns a copy of <var>x</var> with its precision
- increased by <var>n</var> bits, and the <code>shrink</code> function returns a
- copy of <var>x</var> with its precision reduced by <var>n</var> bits.
- <ul>
- <li>The precisions are silently capped at the maximum or floored at the
- <a name="index-precision-795"></a>minimum allowable precisions if necessary.
- <li>Increasing the precision by the <code>grow</code> function does not directly
- cause a more accurate result to be computed, but only pads an existing
- number with zeros.
- <li>Decreasing the precision by the <code>shrink</code> function does not prevent
- valid bits from being discarded.
- </ul>
- <p>The appropriate way to use <code>grow</code> is to grow the precision of an
- operand before applying an operator to it, which will cause the result
- to be computed to the full precision. This capability is suitable for
- algorithms that iterate over increasing precisions until a stopping
- criterion is met.
- </body></html>
|