Node:Rational Arithmetic, Next:, Previous:Rational Conversions, Up:Rational Number Functions



Arithmetic Functions

void mpq_add (mpq_t sum, mpq_t addend1, mpq_t addend2) Function
Set sum to addend1 + addend2.

void mpq_sub (mpq_t difference, mpq_t minuend, mpq_t subtrahend) Function
Set difference to minuend - subtrahend.

void mpq_mul (mpq_t product, mpq_t multiplier, mpq_t multiplicand) Function
Set product to multiplier times multiplicand.

void mpq_mul_2exp (mpq_t rop, mpq_t op1, unsigned long int op2) Function
Set rop to op1 times 2 raised to op2.

void mpq_div (mpq_t quotient, mpq_t dividend, mpq_t divisor) Function
Set quotient to dividend/divisor.

void mpq_div_2exp (mpq_t rop, mpq_t op1, unsigned long int op2) Function
Set rop to op1 divided by 2 raised to op2.

void mpq_neg (mpq_t negated_operand, mpq_t operand) Function
Set negated_operand to -operand.

void mpq_abs (mpq_t rop, mpq_t op) Function
Set rop to the absolute value of op.

void mpq_inv (mpq_t inverted_number, mpq_t number) Function
Set inverted_number to 1/number. If the new denominator is zero, this routine will divide by zero.