mp_base_mp_d Property |
Namespace: Math.Gmp.Native
In mpz_t:
A pointer to an array of limbs which is the magnitude. These are stored “little endian” as per the mpn functions, so _mp_d[0] is the least significant limb and _mp_d[ABS(_mp_size) - 1] is the most significant. Whenever _mp_size is non-zero, the most significant limb is non-zero.
Currently there’s always at least one limb allocated, so for instance mpz_set_ui(mpz_t, UInt32) never needs to reallocate, and mpz_get_ui(mpz_t) can fetch _mp_d[0] unconditionally (though its value is then only wanted if _mp_size is non-zero).
In mpz_t:
A pointer to the array of limbs which is the absolute value of the mantissa. These are stored "little endian" as per the mpn functions, so _mp_d[0] is the least significant limb and _mp_d[ABS(_mp_size)-1] the most significant.
The most significant limb is always non-zero, but there are no other restrictions on its value, in particular the highest 1 bit can be anywhere within the limb.
_mp_prec + 1 limbs are allocated to _mp_d, the extra limb being for convenience (see below). There are no reallocations during a calculation, only in a change of precision with mpf_set_prec(mpf_t, mp_bitcnt_t).