www.delorie.com/gnu/docs/gmp/gmp_42.html   search  
 
Buy GNU books!


GNU MP 4.1.2

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.15 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_size (mpz_t op)
Return the size of op measured in number of limbs. If op is zero, the returned value will be zero.

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

This function is useful in order to allocate the right amount of space before 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).


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003