CGAL 4.14 - Number Types
|
#include <CGAL/Gmpz.h>
An object of the class Gmpz
is an arbitrary precision integer based on the Gmp Library.
Implementation
Gmpz
s 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 | |
Gmpz & | operator++ () |
prefix increment. | |
Gmpz | operator++ (int) |
postfix increment. | |
Gmpz & | operator-- () |
prefix decrement. | |
Gmpz | operator-- (int) |
postfix decrement. | |
Gmpz & | operator>>= (const long &i) |
rightshift by i , where i >= 0 . | |
Gmpz & | operator<<= (const long &i) |
leftshift by i , where i >= 0 . | |
Gmpz & | operator &= (const Gmpz &b) |
bitwise AND. | |
Gmpz & | operator|= (const Gmpz &b) |
bitwise IOR. | |
Gmpz & | operator^= (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... | |
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).