| www.delorie.com/gnu/docs/gmp/gmp_31.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes functions for converting GMP integers to standard C types. Functions for converting to GMP integers are described in 5.2 Assignment Functions and 5.12 Input and Output Functions.
unsigned long.
If op is too big to fit an unsigned long then just the least
significant bits that do fit are returned. The sign of op is ignored,
only the absolute value is used.
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 signed long int, the returned
result is probably not very useful. To find out if the value will fit, use
the function mpz_fits_slong_p.
double.
If str is NULL, the result string is allocated using the current
allocation function (see section 14. Custom Allocation). The block will be
strlen(str)+1 bytes, that being exactly enough for the string and
null-terminator.
If str is not NULL, it should point to a block of storage large
enough for the result, that being mpz_sizeinbase (op, base)
+ 2. The two extra bytes are for a possible minus sign, and the
null-terminator.
A pointer to the result string is returned, being either the allocated block, or the given str.
mpz_size can be used to find how many limbs make up op.
mpz_getlimbn returns zero if n is outside the range 0 to
mpz_size(op)-1.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |