Next: , Previous: , Up: MPIR Basics   [Index]


3.2 Nomenclature and Types

In this manual, integer usually means a multiple precision integer, as defined by the MPIR library. The C data type for such integers is mpz_t. Here are some examples of how to declare such integers:

mpz_t sum;

struct foo { mpz_t x, y; };

mpz_t vec[20];

Rational number means a multiple precision fraction. The C data type for these fractions is mpq_t. For example:

mpq_t quotient;

Floating point number or Float for short, is an arbitrary precision mantissa with a limited precision exponent. The C data type for such objects is mpf_t. For example:

mpf_t fp;

The floating point functions accept and return exponents in the C type mp_exp_t. Currently this is usually a long, but on some systems it’s an int for efficiency.

A limb means the part of a multi-precision number that fits in a single machine word. (We chose this word because a limb of the human body is analogous to a digit, only larger, and containing several digits.) Normally a limb is 32 or 64 bits. The C data type for a limb is mp_limb_t.

Counts of limbs are represented in the C type mp_size_t. Currently this is normally a long, but on some systems it’s an int for efficiency.

Counts of bits of a multi-precision number are represented in the C type mp_bitcnt_t. Currently this is always an unsigned long, but on some systems it will be an unsigned long long in the future .

Random state means an algorithm selection and current state data. The C data type for such objects is gmp_randstate_t. For example:

gmp_randstate_t rstate;

Also, in general mp_bitcnt_t is used for bit counts and ranges, and size_t is used for byte or character counts.


Next: MPIR on Windows x64, Previous: Headers and Libraries, Up: MPIR Basics   [Index]