## CGAL::Gmpq

### Definition

An object of the class Gmpq is an arbitrary precision rational number based on the GNU Multiple Precision Arithmetic Library.

#include <CGAL/Gmpq.h>

### Is Model for the Concept

FieldNumberType

### Types

Gmpq::NT
| the field type, which is Gmpz.

### Creation

Gmpq q;
| creates an uninitialized multiple precision rational number q.
Gmpq q ( int i);
| creates a multiple-precision rational number initialized with i.
Gmpq q ( Gmpz n);
| creates a multiple-precision rational number initialized with n.
Gmpq q ( int n, int d);
| creates a multiple-precision rational number initialized with n/d.
Gmpq q ( signed long n, unsigned long d);
| creates a multiple-precision rational number initialized with n/d.
Gmpq q ( unsigned long n, unsigned long d);
| creates a multiple-precision rational number initialized with n/d.
Gmpq q ( Gmpz n, Gmpz d);
| creates a multiple-precision rational number initialized with n/d.
Gmpq q ( double d);
| creates a multiple-precision rational number initialized with d.
Gmpq q ( std::string str);
| creates a multiple-precision rational number initialized with str.
Gmpq q ( std::string str, int base);
| creates a multiple-precision rational number initialized with str.

### Operations

There are two access functions, namely to the numerator and the denominator of a ratioanal. Note that these values are not uniquely defined. It is guaranteed that q.numerator() and q.denominator() return values nt_num and nt_den such that q = nt_num/nt_den, only if q.numerator() and q.denominator() are called consecutively wrt q, i.e. q is not involved in any other operation between these calls.

Gmpz | q.numerator () | returns the numerator of q.
Gmpz | q.denominator () | returns the denominator of q.

### Implementation

Gmpqs are reference counted.