CGAL 6.1.1 - Number Types

Loading...
Searching...
No Matches
List of all members | Related Functions
CGAL::Gmpzf Class Reference
Reference Manual » GMP

`#include <CGAL/Gmpzf.h>`

## Definition

An object of the class `Gmpzf` is a multiple-precision floating-point number which can represent numbers of the form \( m*2^e\), where \( m\) is an arbitrary precision integer based on the GMP library, and \( e\) is of type `long`.

This type can be considered exact, even if the exponent is not a multiple-precision number. This number type offers functionality very similar to `MP_Float` but is generally faster. `Mpzf` also provides similar functionality and is generally faster than `Gmpzf`.

Is model of
  `EuclideanRing`
  `RealEmbeddable`

Implementation

The significand \( m\) of a `Gmpzf` is a `Gmpz` and is reference counted. The exponent \( e\) of a `Gmpzf` is a `long`.

## Related Functions
(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &out, const Gmpzf &f)
| writes a double approximation of `f` to the ostream `out`.
std::ostream & | print (std::ostream &out, const Gmpzf &f)
| writes an exact representation of `f` to the ostream `out`.
std::istream & | operator>> (std::istream &in, Gmpzf &f)
| reads a `double` from `in`, then converts it to a `Gmpzf`.

## Creation
| Gmpzf ()
| creates a `Gmpzf` initialized with `0`.
| Gmpzf (int i)
| creates a `Gmpzf` initialized with `i`.
| Gmpzf (long int l)
| creates a `Gmpzf` initialized with `l`.
| Gmpzf (const Gmpz &i)
| creates a `Gmpzf` initialized with `i`.
| Gmpzf (const Gmpfr &f)
| creates a `Gmpzf` initialized with `f`.
| Gmpzf (double d)
| creates a `Gmpzf` initialized with `d`.