DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK

# (gmp.info.gz) Miscellaneous Integer Functions

Info Catalog (gmp.info.gz) Integer Import and Export (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Special Functions
```
Miscellaneous Functions
=======================

- Function: int mpz_fits_ulong_p (mpz_t OP)
- Function: int mpz_fits_slong_p (mpz_t OP)
- Function: int mpz_fits_uint_p (mpz_t OP)
- Function: int mpz_fits_sint_p (mpz_t OP)
- Function: int mpz_fits_ushort_p (mpz_t OP)
- Function: int mpz_fits_sshort_p (mpz_t OP)
Return non-zero iff the value of OP fits in an `unsigned long int',
`signed long int', `unsigned int', `signed int', `unsigned short
int', or `signed short int', respectively.  Otherwise, return zero.

- Macro: int mpz_odd_p (mpz_t OP)
- Macro: int mpz_even_p (mpz_t OP)
Determine whether OP is odd or even, respectively.  Return
non-zero if yes, zero if no.  These macros evaluate their argument
more than once.

- Function: size_t mpz_sizeinbase (mpz_t OP, int BASE)
Return the size of OP measured in number of digits in the given
BASE.  BASE can vary from 2 to 36.  The sign of OP is ignored,
just the absolute value is used.  The result will be either exact
or 1 too big.  If BASE is a power of 2, the result is always
exact.  If OP is zero the return value is always 1.

This function can be used to determine the space required when
converting OP to a string.  The right amount of allocation is
normally two more than the value returned by `mpz_sizeinbase', one
extra for a minus sign and one for the null-terminator.

It will be noted that `mpz_sizeinbase(OP,2)' can be used to locate
the most significant 1 bit in OP, counting from 1.  (Unlike the
bitwise functions which start from 0,  Logical and Bit
Manipulation Functions Integer Logic and Bit Fiddling.)

```
Info Catalog (gmp.info.gz) Integer Import and Export (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Special Functions
automatically generated byinfo2html