5.5 Arithmetic Functions

Function: void mpz_add (mpz_t rop, const mpz_t op1, const mpz_t op2)
Function: void mpz_add_ui (mpz_t rop, const mpz_t op1, unsigned long int op2)

Set rop to op1 + op2.

Function: void mpz_sub (mpz_t rop, const mpz_t op1, const mpz_t op2)
Function: void mpz_sub_ui (mpz_t rop, const mpz_t op1, unsigned long int op2)
Function: void mpz_ui_sub (mpz_t rop, unsigned long int op1, const mpz_t op2)

Set rop to op1op2.

Function: void mpz_mul (mpz_t rop, const mpz_t op1, const mpz_t op2)
Function: void mpz_mul_si (mpz_t rop, const mpz_t op1, long int op2)
Function: void mpz_mul_ui (mpz_t rop, const mpz_t op1, unsigned long int op2)

Set rop to op1 times op2.

Function: void mpz_addmul (mpz_t rop, const mpz_t op1, const mpz_t op2)
Function: void mpz_addmul_ui (mpz_t rop, const mpz_t op1, unsigned long int op2)

Set rop to rop + op1 times op2.

Function: void mpz_submul (mpz_t rop, const mpz_t op1, const mpz_t op2)
Function: void mpz_submul_ui (mpz_t rop, const mpz_t op1, unsigned long int op2)

Set rop to rop - op1 times op2.

Function: void mpz_mul_2exp (mpz_t rop, const mpz_t op1, mp_bitcnt_t op2)

Set rop to op1 times 2 raised to op2. This operation can also be defined as a left shift by op2 bits.

Function: void mpz_neg (mpz_t rop, const mpz_t op)

Set rop to −op.

Function: void mpz_abs (mpz_t rop, const mpz_t op)

Set rop to the absolute value of op.