The concept RingNumberType defines the syntactic requirements a number type must meet in order to be used in CGAL as a ring type. This implies that CGAL::Number_type_traits<RingNumberType>::Has_division is not required to be CGAL::Tag_true. Unsigned numbers are excluded due to semantical limitations in the ordering.
CopyConstructible, Assignable
| |
Declaration of a variable.
| |
| |
Declaration and initialization with a small integer
constant , . The neutral elements for addition
(zero) and multiplication (one) are needed quite often, but sometimes
other small constants are useful too. The value 127 was chosen such
that even signed 8 bit number types can fulfill this condition.
|
The comparison operators need to be provided.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In addition, the comparisons with small values of type int are also required.
The arithmetic operators for the addition, subtraction and multiplication are required as well.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
And similarly, the mixed operators with small values of type int are also required.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following accessory functions are needed for special purposes :
|
| Not all values of a number type need be valid. The function is_valid checks this. For example, an expression like NT(0)/NT(0) can result in an invalid number. Routines may have as a precondition that all numerical values are valid. |
|
| When two large values are multiplied, the result may not fit in a NT. Some number types (e.g. the standard float and double types) have a way to represent a too big value as infinity. is_finite implies is_valid. |
|
| gives the double value for a number type. This is usually an approximation for the real (stored) value. It can be used to send numbers to a renderer or to store them in a file. |
| ||
| gives a double interval that encloses n. |
C++ built-in number types
CGAL::Filtered_exact<RingNumberType, ET>
CGAL::Fixed_precision_nt
CGAL::Gmpq
CGAL::Gmpz
CGAL::Interval_nt
CGAL::Interval_nt_advanced
CGAL::Lazy_exact_nt<RingNumberType>
CGAL::MP_Float
CGAL::Quotient<RingNumberType>
leda_integer
leda_rational
leda_bigfloat
leda_real