Rational Arithmetic (GNU MP 6.3.0)
Description: How to install and use the GNU multiple precision arithmetic library, version 6.3.0.

### 6.3 Arithmetic Functions ¶

Function: `void` mpq_add `(mpq_t sum, const mpq_t addend1, const mpq_t addend2)` ¶

  Set sum to addend1 + addend2.

Function: `void` mpq_sub `(mpq_t difference, const mpq_t minuend, const mpq_t subtrahend)` ¶

  Set difference to minuend − subtrahend.

Function: `void` mpq_mul `(mpq_t product, const mpq_t multiplier, const mpq_t multiplicand)` ¶

  Set product to multiplier times multiplicand.

Function: `void` mpq_mul_2exp `(mpq_t rop, const mpq_t op1, mp_bitcnt_t op2)` ¶

  Set rop to op1 times 2 raised to op2.

Function: `void` mpq_div `(mpq_t quotient, const mpq_t dividend, const mpq_t divisor)` ¶

  Set quotient to dividend/divisor.

Function: `void` mpq_div_2exp `(mpq_t rop, const mpq_t op1, mp_bitcnt_t op2)` ¶

  Set rop to op1 divided by 2 raised to op2.

Function: `void` mpq_neg `(mpq_t negated_operand, const mpq_t operand)` ¶

  Set negated_operand to −operand.

Function: `void` mpq_abs `(mpq_t rop, const mpq_t op)` ¶

  Set rop to the absolute value of op.

Function: `void` mpq_inv `(mpq_t inverted_number, const mpq_t number)` ¶

  Set inverted_number to 1/number. If the new denominator is zero, this routine will divide by zero.