Go to the first, previous, next, last section, table of contents.


Applying Integer Functions to Rationals

The set of mpq functions is quite small. In particular, there are no functions for either input or output. But there are two macros that allow us to apply any mpz function on the numerator or denominator of a rational number. If these macros are used to assign to the rational number, mpq_canonicalize normally need to be called afterwards.

Macro: mpz_t mpq_numref (mpq_t op)
Macro: mpz_t mpq_denref (mpq_t op)
Return a reference to the numerator and denominator of op, respectively. The mpz functions can be used on the result of these macros.


Go to the first, previous, next, last section, table of contents.