Re: mpq_cmp_z

2015-08-19 Thread Marco Bodrato
Ciao, On Sun, August 16, 2015 11:50 pm, Torbjörn Granlund wrote: > On Sat, August 15, 2015 12:37 pm, Vincent Delecroix wrote: > > it would be convenient to have a GMP function > > > > int mpq_cmp_z(mpq_t, mpz_t) > We might consider some code sharing between the mpq_cmp and this > func

Re: mpq_cmp_z

2015-08-19 Thread Torbjörn Granlund
"Marco Bodrato" writes: Should we specialise code in mpq_cmp so that it is faster when a denominator is 1? Then write: Absolutely worth considering. mpq_cmp_z (mpq_srcptr q, mpz_srcptr z) { static const mp_limb_t dummy = 1; mpq_t qz; SIZ(NUM(qz)) = SIZ(z); PTR(NUM(

Re: mpq_cmp_z

2015-08-19 Thread Marco Bodrato
Ciao, On Sun, August 16, 2015 11:50 pm, Torbjörn Granlund wrote: > On Sat, August 15, 2015 12:37 pm, Vincent Delecroix wrote: > > rationals. We often have to compare integers with rationals and I came > > to the conclusion that it would be convenient to have a GMP function > > > > in

Re: Anomaly in mpn_sqrtrem and mpn_rootrem

2015-08-19 Thread Torbjörn Granlund
"Marco Bodrato" writes: Before the changes I just pushed, I simply reordered the steps in the loop to shorten the first and the last iteration in the loop... Resulting in even better performance, I presume? > How much speed difference is there now, for k = 4 vs sqrt(sqrt())?