NT must be at least model of concept IntegralDomainWithoutDivision.
NT must be a model of concept RealEmbeddable.
#include <CGAL/Quotient.h>
Quotient<NT> q; | |||
introduces an uninitialized variable q.
| |||
template <class T> | |||
Quotient<NT> q ( T t); | |||
introduces the quotient t/1. NT needs to have a constructor from T.
| |||
template <class T> | |||
Quotient<NT> q ( Quotient<T> t); | |||
introduces the quotient NT(t.numerator())/NT(t.denominator()).
NT needs to have a constructor from T.
| |||
Quotient<NT> q ( NT n, NT d); | |||
introduces the quotient n/d.
|
There are two access functions, namely to the numerator and the denominator of a quotient. 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.
NT | q.numerator () const | returns a numerator of q. |
NT | q.denominator () const | returns a denominator of q. |
The stream operations are available as well. They assume that corresponding stream operators for type NT exist.
The following functions are added to fulfill the Cgal requirements on number types.
double | to_double ( q) | returns some double approximation to q. |
bool | is_valid ( q) | returns true, if numerator and denominator are valid. |
bool | is_finite ( q) | returns true, if numerator and denominator are finite. |
Quotient<NT> | sqrt ( q) | returns the square root of q. This is supported if and only if NT supports the square root as well. |