This section describes functions for converting arbitrary precision integers to standard C types. Functions for converting to arbitrary precision integers are described in section Assignment Functions and section Input and Output Functions.
mpz_tdiv_q_2exp(..., op, CHAR_BIT*sizeof(unsigned
long int))
can be used to extract the limbs of an integer efficiently.
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.
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.
Go to the first, previous, next, last section, table of contents.