Public Member Functions | |
Z_NR () | |
Z_NR (const Z_NR< Z > &z) | |
Z_NR (const Z &z) | |
~Z_NR () | |
Z & | get_data () |
const Z & | get_data () const |
double | get_d () const |
long | get_si () const |
void | get_mpz (mpz_t r) const |
long | exponent () const |
template<class F > | |
void | get_f_exp (F &f, long &expo) |
template<class F > | |
void | set_f (const FP_NR< F > &f) |
void | set_str (const char *s) |
int | cmp (const Z_NR< Z > &m) const |
int | sgn () const |
void | operator= (const Z_NR< Z > &z) |
void | operator= (const mpz_t &z) |
void | operator= (long i) |
bool | operator< (const Z_NR< Z > &a) const |
bool | operator< (long a) const |
bool | operator> (const Z_NR< Z > &a) const |
bool | operator> (long a) const |
bool | operator<= (const Z_NR< Z > &a) const |
bool | operator<= (long a) const |
bool | operator>= (const Z_NR< Z > &a) const |
bool | operator>= (long a) const |
bool | operator== (const Z_NR< Z > &a) const |
bool | operator== (long a) const |
bool | operator!= (const Z_NR< Z > &a) const |
bool | operator!= (long a) const |
Z_NR & | max_z (Z_NR< Z > &b) |
bool | is_zero () const |
void | add (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | add_ui (const Z_NR< Z > &a, unsigned int b) |
void | sub (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | sub_ui (const Z_NR< Z > &a, unsigned int b) |
void | mod (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | neg (const Z_NR< Z > &a) |
void | mul (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | mul_si (const Z_NR< Z > &a, long b) |
void | mul_ui (const Z_NR< Z > &a, unsigned long b) |
void | mul_2si (const Z_NR< Z > &a, long b) |
void | div_2si (const Z_NR< Z > &a, long b) |
void | addmul (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | addmul_ui (const Z_NR< Z > &a, unsigned long b) |
void | addmul_si (const Z_NR< Z > &a, long b) |
void | submul (const Z_NR< Z > &a, const Z_NR< Z > &b) |
void | submul_ui (const Z_NR< Z > &a, unsigned long b) |
void | abs (const Z_NR< Z > &a) |
void | swap (Z_NR< Z > &a) |
void | randb (int bits) |
void | randb_si (int bits) |
void | randm (const Z_NR< Z > &max) |
void | randm_si (const Z_NR< Z > &max) |
void | nextprime (const Z_NR< Z > &nbr) |
Detailed Description
class Z_NR< Z >
Z_NR stores integers. This template provides a uniform interface for doing integer computations with several underlying types (long, double and mpz_t).
Constructor & Destructor Documentation
◆ Z_NR() [1/3]
◆ Z_NR() [2/3]
◆ Z_NR() [3/3]
◆ ~Z_NR()
Member Function Documentation
◆ abs()
value := absolute value of a.
◆ add()
arithmetic value := a + b.
◆ add_ui()
◆ addmul()
|
inline |
value := value + a * b.
◆ addmul_si()
◆ addmul_ui()
◆ cmp()
comparison 3-way comparison. Returns a positive number if *this > m, a negative number if *this < m or zero is *this == m.
◆ div_2si()
value := a / 2^b. if Z=long and |b| >= size_in_bits(a), the result is undefined.
◆ exponent()
|
inline |
Returns the smallest non-negative expo such that |value| < 2^expo.
◆ get_d()
|
inline |
Converts this object to a double. If it does not fit in a double, the result is undefined.
◆ get_data() [1/2]
|
inline |
get data Returns the internal representation of the data.
◆ get_data() [2/2]
|
inline |
Returns the internal representation of the data.
◆ get_f_exp()
|
inline |
Computes f and expo such that 0.5 <= f < 1 and value ~= 2^expo * f. The rounding direction is undefined. This function is implemented only for native floating-point types (double and long double), otherwise the behaviour is undefined.
◆ get_mpz()
|
inline |
Converts this object to a mpz.
◆ get_si()
|
inline |
Converts this object to a long double. If it does not fit in a long double, the result is undefined. Converts this object to a long. If it does not fit in a long, the result is undefined.
◆ is_zero()
|
inline |
Returns non-zero if the current value is zero, 0 otherwise.
◆ max_z()
◆ mod()
value := a mod b
◆ mul()
value := a * b.
◆ mul_2si()
value := a * 2^b. if Z=long and |b| >= size_in_bits(a), the result is undefined.
◆ mul_si()
value := a * b.
◆ mul_ui()
◆ neg()
◆ nextprime()
Generates smallest prime number above nbr
◆ operator!=() [1/2]
◆ operator!=() [2/2]
|
inline |
◆ operator<() [1/2]
◆ operator<() [2/2]
|
inline |
◆ operator<=() [1/2]
◆ operator<=() [2/2]
|
inline |
◆ operator=() [1/3]
|
inline |
◆ operator=() [2/3]
◆ operator=() [3/3]
|
inline |
◆ operator==() [1/2]
◆ operator==() [2/2]
|
inline |
◆ operator>() [1/2]
◆ operator>() [2/2]
|
inline |
◆ operator>=() [1/2]
◆ operator>=() [2/2]
|
inline |
◆ randb()
|
inline |
Generates random integer between 0 and 2^bits-1.
◆ randb_si()
|
inline |
◆ randm()
Generates random integer between 0 and max - 1
◆ randm_si()
◆ set_f()
set data Sets the value to x. When FT=mpfr_t, x is rounded to the nearest integer and if the fractional part of x is 0.5, the even integer is chosen when. Otherwise, the rounding direction is undefined.
◆ set_str()
|
inline |
Sets the value to s, signed integer in basis 10.
◆ sgn()
|
inline |
Sign. Returns a positive number, a negative number or zero if the value of this object is respectively positive, negative or null.
◆ sub()
value := a - b.
◆ sub_ui()
◆ submul()
|
inline |
value := value - a * b.
◆ submul_ui()
◆ swap()
Efficiently swaps the values of two Z_NR.
The documentation for this class was generated from the following files: