DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(gmp.info.gz) Applying Integer Functions

Info Catalog (gmp.info.gz) Comparing Rationals (gmp.info.gz) Rational Number Functions (gmp.info.gz) I/O of Rationals
 
 Applying Integer Functions to Rationals
 =======================================
 
 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 ( Rational Number Functions) then
 `mpq_canonicalize' must be called before any other `mpq' functions are
 applied to that `mpq_t'.
 
  - 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.
 
  - Function: void mpq_get_num (mpz_t NUMERATOR, mpq_t RATIONAL)
  - Function: void mpq_get_den (mpz_t DENOMINATOR, mpq_t RATIONAL)
  - Function: void mpq_set_num (mpq_t RATIONAL, mpz_t NUMERATOR)
  - Function: void mpq_set_den (mpq_t RATIONAL, mpz_t DENOMINATOR)
      Get or set the numerator or denominator of a rational.  These
      functions are equivalent to calling `mpz_set' with an appropriate
      `mpq_numref' or `mpq_denref'.  Direct use of `mpq_numref' or
      `mpq_denref' is recommended instead of these functions.
 
Info Catalog (gmp.info.gz) Comparing Rationals (gmp.info.gz) Rational Number Functions (gmp.info.gz) I/O of Rationals
automatically generated byinfo2html