Previous: Custom Interface, Up: MPFR Interface [Index]
A limb means the part of a multi-precision number that fits in a single
word. Usually a limb contains
32 or 64 bits. The C data type for a limb is mp_limb_t
.
The mpfr_t
type is internally defined as a one-element
array of a structure, and mpfr_ptr
is the C data type representing
a pointer to this structure.
The mpfr_t
type consists of four fields:
_mpfr_prec
field is used to store the precision of
the variable (in bits); this is not less than MPFR_PREC_MIN
.
_mpfr_sign
field is used to store the sign of the variable.
_mpfr_exp
field stores the exponent.
An exponent of 0 means a radix point just above the most significant
limb. Non-zero values n are a multiplier 2^n relative to that
point.
A NaN, an infinity and a zero are indicated by special values of the exponent
field.
_mpfr_d
field is a pointer to the limbs, least
significant limbs stored first.
The number of limbs in use is controlled by _mpfr_prec
, namely
ceil(_mpfr_prec
/mp_bits_per_limb
).
Non-singular (i.e., different from NaN, Infinity or zero)
values always have the most significant bit of the most
significant limb set to 1. When the precision does not correspond to a
whole number of limbs, the excess bits at the low end of the data are zeros.