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

Creation

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

Operations

Gmpzoperator++ ()
 prefix increment. More...
 
Gmpz operator++ (int)
 postfix increment. More...
 
Gmpzoperator-- ()
 prefix decrement. More...
 
Gmpz operator-- (int)
 postfix decrement. More...
 
Gmpzoperator>>= (const long &i)
 rightshift by i, where i >= 0. More...
 
Gmpzoperator<<= (const long &i)
 leftshift by i, where i >= 0. More...
 
Gmpzoperator&= (const Gmpz &b)
 bitwise AND. More...
 
Gmpzoperator|= (const Gmpz &b)
 bitwise IOR. More...
 
Gmpzoperator^= (const Gmpz &b)
 bitwise XOR. More...
 
Sign sign () const
 Returns the sign of z. More...
 
size_t bit_size () const
 Returns the bit-size (that is, the number of bits needed to represent the mantissa) of z. More...
 
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...
 

Constructor & Destructor Documentation

CGAL::Gmpz::Gmpz ( )

creates an uninitialized multiple precision integer z.

CGAL::Gmpz::Gmpz ( int  i)

creates a multiple-precision integer initialized with i.

CGAL::Gmpz::Gmpz ( double  d)

creates a multiple-precision integer initialized with the integral part of d.

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::bit_size ( ) const

Returns the bit-size (that is, the number of bits needed to represent the mantissa) of z.

Gmpz& CGAL::Gmpz::operator&= ( const Gmpz b)

bitwise AND.

Gmpz& CGAL::Gmpz::operator++ ( )

prefix increment.

Gmpz CGAL::Gmpz::operator++ ( int  )

postfix increment.

Gmpz& CGAL::Gmpz::operator-- ( )

prefix decrement.

Gmpz CGAL::Gmpz::operator-- ( int  )

postfix decrement.

Gmpz& CGAL::Gmpz::operator<<= ( const long &  i)

leftshift by i, where i >= 0.

Gmpz& CGAL::Gmpz::operator>>= ( const long &  i)

rightshift by i, where i >= 0.

Gmpz& CGAL::Gmpz::operator^= ( const Gmpz b)

bitwise XOR.

Gmpz& CGAL::Gmpz::operator|= ( const Gmpz b)

bitwise IOR.

Sign CGAL::Gmpz::sign ( ) const

Returns the sign of z.

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

Friends And Related Function Documentation

Gmpz operator& ( const Gmpz a,
const Gmpz b 
)
related

bitwise AND.

Gmpz operator<< ( const Gmpz a,
unsigned long  i 
)
related

leftshift by i.

std::ostream & operator<< ( std::ostream &  out,
const Gmpz z 
)
related

writes z to the ostream out.

Gmpz operator>> ( const Gmpz a,
unsigned long  i 
)
related

rightshift by i.

std::istream & operator>> ( std::istream &  in,
Gmpz z 
)
related

reads an integer from in, then converts it to a Gmpz.

Gmpz operator^ ( const Gmpz a,
const Gmpz b 
)
related

bitwise XOR.

Gmpz operator| ( const Gmpz a,
const Gmpz b 
)
related

bitwise IOR.