\( \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.10.1 - Number Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Gmpz Class Reference

#include <CGAL/Gmpz.h>

Definition

An object of the class Gmpz is an arbitrary precision integer based on the Gmp Library.

Is Model Of:

EuclideanRing

RealEmbeddable

Implementation

Gmpzs are reference counted.

Related Functions

(Note that these are not member functions.)

Gmpz operator>> (const Gmpz &a, unsigned long i)
 rightshift by i.
 
Gmpz operator<< (const Gmpz &a, unsigned long i)
 leftshift by i.
 
Gmpz operator& (const Gmpz &a, const Gmpz &b)
 bitwise AND.
 
Gmpz operator| (const Gmpz &a, const Gmpz &b)
 bitwise IOR.
 
Gmpz operator^ (const Gmpz &a, const Gmpz &b)
 bitwise XOR.
 
std::ostream & operator<< (std::ostream &out, const Gmpz &z)
 writes z to the ostream out.
 
std::istream & operator>> (std::istream &in, Gmpz &z)
 reads an integer from in, then converts it to a Gmpz.
 

Creation

 Gmpz ()
 creates an uninitialized multiple precision integer z.
 
 Gmpz (int i)
 creates a multiple-precision integer initialized with i.
 
 Gmpz (double d)
 creates a multiple-precision integer initialized with the integral part of d.
 

Operations

Gmpzoperator++ ()
 prefix increment.
 
Gmpz operator++ (int)
 postfix increment.
 
Gmpzoperator-- ()
 prefix decrement.
 
Gmpz operator-- (int)
 postfix decrement.
 
Gmpzoperator>>= (const long &i)
 rightshift by i, where i >= 0.
 
Gmpzoperator<<= (const long &i)
 leftshift by i, where i >= 0.
 
Gmpzoperator&= (const Gmpz &b)
 bitwise AND.
 
Gmpzoperator|= (const Gmpz &b)
 bitwise IOR.
 
Gmpzoperator^= (const Gmpz &b)
 bitwise XOR.
 
Sign sign () const
 Returns the sign of z.
 
size_t bit_size () const
 Returns the bit-size (that is, the number of bits needed to represent the mantissa) of z.
 
size_t size () const
 Returns the size in limbs of z. More...
 
size_t approximate_decimal_length () const
 Returns the approximate number of decimal digits needed to represent z. More...
 
double to_double () const
 Returns a double approximation of z. More...
 

Member Function Documentation

size_t CGAL::Gmpz::approximate_decimal_length ( ) const

Returns the approximate number of decimal digits needed to represent z.

Approximate means either a correct result, either the correct result plus one.

size_t CGAL::Gmpz::size ( ) const

Returns the size in limbs of z.

A limb is the type used by Gmp to represent the integer (usually long).

double CGAL::Gmpz::to_double ( ) const

Returns a double approximation of z.

The integer is truncated if needed. If the exponent of the conversion is too big, the result is system dependent (returning infinity where it is supported).