[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mpfr
conversion functionsThe functions described in this section convert between mpfr
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 mpfr
library’s
native API, the names have been changed for mnemonic reasons.
dbl2mp
The input is a standard floating point number as in math
. The
result is an mpfr
number equal to the input with a
fixed precision, currently set to 160 bits.
mp2dbl
The input is an mpfr
number, and the output is the best
possible approximation to it by a standard a double precision
number.
str2mp
The input is a pair (prec,s)
, where prec is a
natural number specifying the precision, and s is a string
expressing a floating point number in C format. The output is an
mpfr
number with the specified precision.
mp2str
The input is an mpfr
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.
nat2mp
The input is a natural number represented as described in
Representation of Numeric and Textual Data,
and the output is an mpfr
number of sufficient precision to
express the natural number exactly.
The mp2str
function enhances the native mpfr_get_str
function by properly formatting the output string rather than only
listing the digits of the mantissa.
The nat2mp
function does not rely on the mpfr
native
integer conversion functions, so natural numbers with any number of
bits up to MP_PREC_MAX
can be used losslessly. There is
currently no conversion in the other direction.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on December 10, 2012 using texi2html 1.82.