Class

CGAL::Gmpzf

Definition

This is an multiple-precision floating-point type; it can represent numbers of the form m*2e, where m is an arbitrary precision integer based on the Gnu Multiple Precision Arithmetic 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.

#include <CGAL/Gmpzf.h>

Is Model for the Concepts

EuclideanRing

RealEmbeddable

Creation

Gmpzf f;
creates a Gmpzf initialized with 0.


Gmpzf f ( int i);
creates a Gmpzf initialized with i.


Gmpzf f ( long int l);
creates a Gmpzf initialized with l.


Gmpzf f ( Gmpz i);
creates a Gmpzf initialized with i.


Gmpzf f ( Gmpfr f);
creates a Gmpzf initialized with f.


Gmpzf f ( double d);
creates a Gmpzf initialized with d.

Operations

std::ostream& std::ostream& out << f writes a double approximation of f to the ostream out.

std::ostream& print ( std::ostream& out, f) writes an exact representation of f to the ostream out.

std::istream& std::istream& in >> & f reads a double from in, then converts it to a Gmpzf.

Implementation

The significand m of a Gmpzf is a Gmpz and is reference counted. The exponent e of a Gmpzf is a long.