GNU Info

Info Node: (gmp.info)C++ Interface Integers

(gmp.info)C++ Interface Integers


Next: C++ Interface Rationals Prev: C++ Interface General Up: C++ Class Interface
Enter node , (file) or (file)node

C++ Interface Integers
======================

 - Function: void mpz_class::mpz_class (type N)
     Construct an `mpz_class'.  All the standard C++ types may be used,
     except `long long' and `long double', and all the GMP C++ classes
     can be used.  Any necessary conversion follows the corresponding C
     function, for example `double' follows `mpz_set_d' (Note:
     Assigning Integers).

 - Function: void mpz_class::mpz_class (mpz_t Z)
     Construct an `mpz_class' from 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: void mpz_class::mpz_class (const char *S)
 - Function: void mpz_class::mpz_class (const char *S, int base)
 - Function: void mpz_class::mpz_class (const string& S)
 - Function: void mpz_class::mpz_class (const string& S, int base)
     Construct an `mpz_class' converted from a string using
     `mpz_set_str', (Note: Assigning Integers).  If the BASE is not
     given then 0 is used.

 - Function: mpz_class operator/ (mpz_class A, mpz_class D)
 - Function: mpz_class operator% (mpz_class A, mpz_class D)
     Divisions involving `mpz_class' round towards zero, as per the
     `mpz_tdiv_q' and `mpz_tdiv_r' functions (Note: Integer Division).
     This corresponds to the rounding used for plain `int' calculations
     on most machines.

     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 OP1)
 - Function: int cmp (mpz_class OP1, type OP2)
 - Function: int cmp (type OP1, mpz_class OP2)
 - Function: double mpz_class::get_d (void)
 - Function: long mpz_class::get_si (void)
 - Function: unsigned long mpz_class::get_ui (void)
 - 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: int sgn (mpz_class OP)
 - Function: mpz_class sqrt (mpz_class OP)
     These functions provide a C++ class interface to the corresponding
     GMP C routines.

     `cmp' can be used with any of the classes or the standard C++
     types, except `long long' and `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'.


automatically generated by info2www version 1.2.2.9