The set of mpq functions is quite small. In particular, there are few
functions for either input or output. The following functions give direct
access to the numerator and denominator of an mpq_t.
Note that if an assignment to the numerator and/or denominator could take an
mpq_t out of the canonical form described at the start of this chapter
(see Rational Number Functions) then mpq_canonicalize must be
called before any other mpq functions are applied to that mpq_t.
Return a reference to the numerator and denominator of op, respectively. The
mpzfunctions can be used on the result of these macros.
Get or set the numerator or denominator of a rational. These functions are equivalent to calling
mpz_setwith an appropriatempq_numreformpq_denref. Direct use ofmpq_numreformpq_denrefis recommended instead of these functions.