mpfr-binary-operators-with-a-natural-operand.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html lang="en">
  2. <head>
  3. <title>mpfr binary operators with a natural operand - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="mpfr.html#mpfr" title="mpfr">
  9. <link rel="prev" href="mpfr-unary-operators.html#mpfr-unary-operators" title="mpfr unary operators">
  10. <link rel="next" href="mpfr-binary-predicates.html#mpfr-binary-predicates" title="mpfr binary predicates">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="mpfr-binary-operators-with-a-natural-operand"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="mpfr-binary-predicates.html#mpfr-binary-predicates">mpfr binary predicates</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="mpfr-unary-operators.html#mpfr-unary-operators">mpfr unary operators</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="mpfr.html#mpfr">mpfr</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">D.14.3 <code>mpfr</code> binary operators with a natural operand</h4>
  35. <p>Functions with these names take an argument of the form
  36. <code>(</code><var>x</var><code>,</code><var>n</var><code>)</code>, where <var>x</var> is an <code>mpfr</code> number
  37. and <var>n</var> is a natural number.
  38. <ul>
  39. <li><code>root</code>
  40. <li><code>pow_ui</code>
  41. <li><code>mul_2ui</code>
  42. <li><code>div_2ui</code>
  43. <li><code>grow</code>
  44. <li><code>shrink</code>
  45. </ul>
  46. <p>The last two are specific to the virtual code interface, having no
  47. counterpart in the native API of the <code>mpfr</code> library. The
  48. <code>grow</code> function returns a copy of <var>x</var> with its precision
  49. increased by <var>n</var> bits, and the <code>shrink</code> function returns a
  50. copy of <var>x</var> with its precision reduced by <var>n</var> bits.
  51. <ul>
  52. <li>The precisions are silently capped at the maximum or floored at the
  53. <a name="index-precision-795"></a>minimum allowable precisions if necessary.
  54. <li>Increasing the precision by the <code>grow</code> function does not directly
  55. cause a more accurate result to be computed, but only pads an existing
  56. number with zeros.
  57. <li>Decreasing the precision by the <code>shrink</code> function does not prevent
  58. valid bits from being discarded.
  59. </ul>
  60. <p>The appropriate way to use <code>grow</code> is to grow the precision of an
  61. operand before applying an operator to it, which will cause the result
  62. to be computed to the full precision. This capability is suitable for
  63. algorithms that iterate over increasing precisions until a stopping
  64. criterion is met.
  65. </body></html>