mpz_tdiv_2exp?

Paul Zimmermann Paul.Zimmermann at loria.fr
Fri Sep 19 17:28:56 CEST 2008


       Torbjörn,

>   is there any reason why there is no mpz_[cft]div_2exp function in GMP?
>   Could it be more efficient than the following?
>   
>      mpz_tdiv_q_2exp (q, n, b);
>      mpz_tdiv_r_2exp (r, n, b);
>   
> I am not sure which function you think is missing.
> Perhaps you mean "qr" variants, i.e., mpz_[cft]div_qr_2exp?
> We don't have such combined functions since they wouldn't be any faster
> than the correspnding separate calls.

yes that's what I meant.

> I believe we have a fairly complete set of functions for division by a
> power fo two, with all possible rounding rules.

a function which rounds the quotient to nearest, say mpz_ndiv_qr, would be
quite useful in some applications (any tie-breaking rule would be ok).

Paul


More information about the gmp-discuss mailing list