CGAL 4.7 - Number Types: CGAL::Gmpzf Class Reference

\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.7 - Number Types

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members | Related Functions
CGAL::Gmpzf Class Reference
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.

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`.