Node:Integer Division, Next:Integer Exponentiation, Previous:Integer Arithmetic, Up:Integer Functions
Division is undefined if the divisor is zero. Passing a zero divisor to the
division or modulo functions (including the modular powering functions
mpz_powm
and mpz_powm_ui
), will cause an intentional division by
zero. This lets a program handle arithmetic exceptions in these functions the
same way as for normal C int
arithmetic.
void mpz_cdiv_q (mpz_t q, mpz_t n, mpz_t d) | Function |
void mpz_cdiv_r (mpz_t r, mpz_t n, mpz_t d) | Function |
void mpz_cdiv_qr (mpz_t q, mpz_t r, mpz_t n, mpz_t d) | Function |
unsigned long int mpz_cdiv_q_ui (mpz_t q, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_cdiv_r_ui (mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_cdiv_qr_ui (mpz_t q, mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_cdiv_ui (mpz_t n, unsigned long int d) | Function |
void mpz_cdiv_q_2exp (mpz_t q, mpz_t n, unsigned long int b) | Function |
void mpz_cdiv_r_2exp (mpz_t r, mpz_t n, unsigned long int b) | Function |
void mpz_fdiv_q (mpz_t q, mpz_t n, mpz_t d) | Function |
void mpz_fdiv_r (mpz_t r, mpz_t n, mpz_t d) | Function |
void mpz_fdiv_qr (mpz_t q, mpz_t r, mpz_t n, mpz_t d) | Function |
unsigned long int mpz_fdiv_q_ui (mpz_t q, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_fdiv_r_ui (mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_fdiv_qr_ui (mpz_t q, mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_fdiv_ui (mpz_t n, unsigned long int d) | Function |
void mpz_fdiv_q_2exp (mpz_t q, mpz_t n, unsigned long int b) | Function |
void mpz_fdiv_r_2exp (mpz_t r, mpz_t n, unsigned long int b) | Function |
void mpz_tdiv_q (mpz_t q, mpz_t n, mpz_t d) | Function |
void mpz_tdiv_r (mpz_t r, mpz_t n, mpz_t d) | Function |
void mpz_tdiv_qr (mpz_t q, mpz_t r, mpz_t n, mpz_t d) | Function |
unsigned long int mpz_tdiv_q_ui (mpz_t q, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_tdiv_r_ui (mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_tdiv_qr_ui (mpz_t q, mpz_t r, mpz_t n, unsigned long int d) | Function |
unsigned long int mpz_tdiv_ui (mpz_t n, unsigned long int d) | Function |
void mpz_tdiv_q_2exp (mpz_t q, mpz_t n, unsigned long int b) | Function |
void mpz_tdiv_r_2exp (mpz_t r, mpz_t n, unsigned long int b) | Function |
Divide n by d, forming a quotient q and/or remainder
r. For the
In all cases q and r will satisfy n=q*d+r, and r will satisfy 0<=abs(r)<abs(d). The For the The |
void mpz_mod (mpz_t r, mpz_t n, mpz_t d) | Function |
unsigned long int mpz_mod_ui (mpz_t r, mpz_t n, unsigned long int d) | Function |
Set r to n mod d. The sign of the divisor is
ignored; the result is always non-negative.
|
void mpz_divexact (mpz_t q, mpz_t n, mpz_t d) | Function |
void mpz_divexact_ui (mpz_t q, mpz_t n, unsigned long d) | Function |
Set q to n/d. These functions produce correct results only
when it is known in advance that d divides n.
These routines are much faster than the other division functions, and are the best choice when exact division is known to occur, for example reducing a rational to lowest terms. |
int mpz_divisible_p (mpz_t n, mpz_t d) | Function |
int mpz_divisible_ui_p (mpz_t n, unsigned long int d) | Function |
int mpz_divisible_2exp_p (mpz_t n, unsigned long int b) | Function |
Return non-zero if n is exactly divisible by d, or in the case of
mpz_divisible_2exp_p by 2^b.
|
int mpz_congruent_p (mpz_t n, mpz_t c, mpz_t d) | Function |
int mpz_congruent_ui_p (mpz_t n, unsigned long int c, unsigned long int d) | Function |
int mpz_congruent_2exp_p (mpz_t n, mpz_t c, unsigned long int b) | Function |
Return non-zero if n is congruent to c modulo d, or in the
case of mpz_congruent_2exp_p modulo 2^b.
|