Go forward to Float Arithmetic.
Go backward to Simultaneous Float Init & Assign.
Go up to Floating-point Functions.
Conversion Functions
====================
- Function: double mpf_get_d (mpf_t OP)
Convert OP to a double.
- Function: char * mpf_get_str (char *STR, mp_exp_t *EXPPTR, int BASE,
size_t N_DIGITS, mpf_t OP)
Convert OP to a string of digits in base BASE. The base may vary
from 2 to 36. Generate at most N_DIGITS significant digits, or if
N_DIGITS is 0, the maximum number of digits accurately
representable by OP.
If STR is NULL, space for the mantissa is allocated using the
default allocation function, and a pointer to the string is
returned.
If STR is not NULL, it should point to a block of storage enough
large for the mantissa, i.e., N_DIGITS + 2. The two extra bytes
are for a possible minus sign, and for the terminating null
character.
The exponent is written through the pointer EXPPTR.
If N_DIGITS is 0, the maximum number of digits meaningfully
achievable from the precision of OP will be generated. Note that
the space requirements for STR in this case will be impossible for
the user to predetermine. Therefore, you need to pass NULL for
the string argument whenever N_DIGITS is 0.
The generated string is a fraction, with an implicit radix point
immediately to the left of the first digit. For example, the
number 3.1416 would be returned as "31416" in the string and 1
written at EXPPTR.