mpz_limbs interface

Niels Möller nisse at lysator.liu.se
Fri Feb 7 10:05:00 UTC 2014


Torbjorn Granlund <tg at gmplib.org> writes:

> But then the shifting done in __gmp_extract_double will be needed in
> every caller. Or am I mistaken?

I think you are right, for all current callers but one. The exception is
mpq_set_d, which needs to remove trailing zero bits for normalization,
using a different shift count.

Other possible exceptions: 

* The various cmp_d functions should in the most likely case not need
  shifting of all of the mantissa bits. They could be arranged to first
  compare whichever top bits are the easiest to shift into the right
  position (in some cases, that would include only the most significant
  one bit of the mantissa), followed by a full comparison to all
  mantissa bits, followed by more and more unlikely comparisons for
  lower limbs being zero.

  (For this trick to work, I suspect mpn_set_d can't be allowed any
  normalization freedom; the most significant one bit must be placed in
  a fix position).

* mpfr, which as far as I understand doesn't do limbification in the
  same way as mpf.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list