Go forward to Integer Arithmetic.
Go backward to Simultaneous Integer Init & Assign.
Go up to Integer Functions.

Conversion Functions
====================

   This section describes functions for converting arbitrary precision
integers to standard C types.  Functions for converting *to* arbitrary
precision integers are described in See Assigning Integers and
See I/O of Integers.

 - Function: unsigned long int mpz_get_ui (mpz_t OP)
     Return the least significant part from OP.  This function combined
     with
     `mpz_tdiv_q_2exp(..., OP, CHAR_BIT*sizeof(unsigned long int))' can
     be used to extract the limbs of an integer.

 - Function: signed long int mpz_get_si (mpz_t OP)
     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 large to fit in a `signed long int', the returned
     result is probably not very useful.

 - Function: double mpz_get_d (mpz_t OP)
     Convert OP to a double.

 - Function: char * mpz_get_str (char *STR, int BASE, mpz_t OP)
     Convert OP to a string of digits in base BASE.  The base may vary
     from 2 to 36.

     If STR is NULL, space for the result string 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 result.  To find out the right amount of space to
     provide for STR, use `mpz_sizeinbase (OP, BASE) + 2'.  The two
     extra bytes are for a possible minus sign, and for the terminating
     null character.