1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <html lang="en">
- <head>
- <title>mpfr conversion functions - 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-functions-with-miscellaneous-calling-conventions.html#mpfr-functions-with-miscellaneous-calling-conventions" title="mpfr functions with miscellaneous calling conventions">
- <link rel="next" href="mpfr-exceptions.html#mpfr-exceptions" title="mpfr exceptions">
- <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-conversion-functions"></a>
- <p>
- Next: <a rel="next" accesskey="n" href="mpfr-exceptions.html#mpfr-exceptions">mpfr exceptions</a>,
- Previous: <a rel="previous" accesskey="p" href="mpfr-functions-with-miscellaneous-calling-conventions.html#mpfr-functions-with-miscellaneous-calling-conventions">mpfr functions with miscellaneous calling conventions</a>,
- Up: <a rel="up" accesskey="u" href="mpfr.html#mpfr">mpfr</a>
- <hr>
- </div>
- <h4 class="subsection">D.14.8 <code>mpfr</code> conversion functions</h4>
- <p>The functions described in this section convert between <code>mpfr</code>
- numbers and character strings, naturals, or standard IEEE floating
- point format (in their list representations). Where these functions
- have similar or equivalent counterparts in the <code>mpfr</code> library's
- native API, the names have been changed for mnemonic reasons.
- <dl>
- <dt><code>dbl2mp</code><dd>The input is a standard floating point number as in <a href="math.html#math">math</a>. The
- result is an <code>mpfr</code> number equal to the input with a
- fixed precision, currently set to 160 bits.
- <br><dt><code>mp2dbl</code><dd>The input is an <code>mpfr</code> number, and the output is the best
- possible approximation to it by a standard a double precision
- number.
- <br><dt><code>str2mp</code><dd>The input is a pair <code>(</code><var>prec</var><code>,</code><var>s</var><code>)</code>, where <var>prec</var> is a
- natural number specifying the precision, and <var>s</var> is a string
- expressing a floating point number in C format. The output is an
- <code>mpfr</code> number with the specified precision.
- <br><dt><code>mp2str</code><dd>The input is an <code>mpfr</code> number, and the output is a character
- string expressing the number in exponential decimal notation.
- Sufficiently many decimal digits are included in the string to express
- the full precision.
- <br><dt><code>nat2mp</code><dd>The input is a natural number represented as described in
- <a href="Representation-of-Numeric-and-Textual-Data.html#Representation-of-Numeric-and-Textual-Data">Representation of Numeric and Textual Data</a>,
- and the output is an <code>mpfr</code> number of sufficient precision to
- express the natural number exactly.
- </dl>
- <p>The <code>mp2str</code> function enhances the native <code>mpfr_get_str</code>
- function by properly formatting the output string rather than only
- listing the digits of the mantissa.
- <p>The <code>nat2mp</code> function does not rely on the <code>mpfr</code> native
- integer conversion functions, so natural numbers with any number of
- bits up to <code>MP_PREC_MAX</code> can be used losslessly. There is
- currently no conversion in the other direction.
- </body></html>
|