Node:Converting Integers, Next:Integer Arithmetic, Previous:Simultaneous Integer Init & Assign, Up:Integer Functions
This section describes functions for converting GMP integers to standard C types. Functions for converting to GMP integers are described in Assigning Integers and I/O of Integers.
| unsigned long int mpz_get_ui (mpz_t op) | Function |
Return the value of op as an unsigned long.
If op is too big to fit an |
| signed long int mpz_get_si (mpz_t op) | Function |
If op fits into a signed long int return the value of op.
Otherwise return the least significant part of op, with the same sign
as op.
If op is too big to fit in a |
| double mpz_get_d (mpz_t op) | Function |
Convert op to a double.
|
| double mpz_get_d_2exp (signed long int *exp, mpz_t op) | Function |
| Find d and exp such that d times 2 raised to exp, with 0.5<=abs(d)<1, is a good approximation to op. |
| char * mpz_get_str (char *str, int base, mpz_t op) | Function |
|
Convert op to a string of digits in base base. The base may vary
from 2 to 36.
If str is If str is not A pointer to the result string is returned, being either the allocated block, or the given str. |
| mp_limb_t mpz_getlimbn (mpz_t op, mp_size_t n) | Function |
|
Return limb number n from op. The sign of op is ignored,
just the absolute value is used. The least significant limb is number 0.
|