| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
12.2 C++ Interface Integers
- Function: mpz_class::mpz_class (type n)
- Construct an - mpz_class. All the standard C++ types may be used, except- long longand- long double, and all the GMP C++ classes can be used, although conversions from- mpq_classand- mpf_classare- explicit. Any necessary conversion follows the corresponding C function, for example- doublefollows- mpz_set_d(see section Assignment Functions).
- Function: explicit mpz_class::mpz_class (const mpz_t z)
- Construct an - mpz_classfrom an- mpz_t. The value in z is copied into the new- mpz_class, there won’t be any permanent association between it and z.
- Function: explicit mpz_class::mpz_class (const char *s, int base = 0)
- Function: explicit mpz_class::mpz_class (const string& s, int base = 0)
- Construct an - mpz_classconverted from a string using- mpz_set_str(see section Assignment Functions).- If the string is not a valid integer, an - std::invalid_argumentexception is thrown. The same applies to- operator=.
- Function: mpz_class operator"" _mpz (const char *str)
- With C++11 compilers, integers can be constructed with the syntax - 123_mpzwhich is equivalent to- mpz_class("123").
- Function: mpz_class operator/ (mpz_class a, mpz_class d)
- Function: mpz_class operator% (mpz_class a, mpz_class d)
- Divisions involving - mpz_classround towards zero, as per the- mpz_tdiv_qand- mpz_tdiv_rfunctions (see section Division Functions). This is the same as the C99- /and- %operators.- The - mpz_fdiv…or- mpz_cdiv…functions can always be called directly if desired. For example,- mpz_class q, a, d; ... mpz_fdiv_q (q.get_mpz_t(), a.get_mpz_t(), d.get_mpz_t()); 
- Function: mpz_class abs (mpz_class op)
- Function: int cmp (mpz_class op1, type op2)
- Function: int cmp (type op1, mpz_class op2)
- Function: bool mpz_class::fits_sint_p (void)
- Function: bool mpz_class::fits_slong_p (void)
- Function: bool mpz_class::fits_sshort_p (void)
- Function: bool mpz_class::fits_uint_p (void)
- Function: bool mpz_class::fits_ulong_p (void)
- Function: bool mpz_class::fits_ushort_p (void)
- Function: double mpz_class::get_d (void)
- Function: long mpz_class::get_si (void)
- Function: string mpz_class::get_str (int base = 10)
- Function: unsigned long mpz_class::get_ui (void)
- Function: int mpz_class::set_str (const char *str, int base)
- Function: int mpz_class::set_str (const string& str, int base)
- Function: int sgn (mpz_class op)
- Function: mpz_class sqrt (mpz_class op)
- Function: void mpz_class::swap (mpz_class& op)
- Function: void swap (mpz_class& op1, mpz_class& op2)
- These functions provide a C++ class interface to the corresponding GMP C routines. - cmpcan be used with any of the classes or the standard C++ types, except- long longand- long double.
Overloaded operators for combinations of mpz_class and double
are provided for completeness, but it should be noted that if the given
double is not an integer then the way any rounding is done is currently
unspecified.  The rounding might take place at the start, in the middle, or at
the end of the operation, and it might change in the future.
Conversions between mpz_class and double, however, are defined
to follow the corresponding C functions mpz_get_d and mpz_set_d.
And comparisons are always made exactly, as per mpz_cmp_d.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
 
  This document was generated on March 31, 2014 using texi2html 5.0.
 
 
