Torbjörn Granlund tg at
Wed Aug 19 18:35:06 UTC 2015

"Marco Bodrato" <bodrato at> 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(qz)) = PTR(z);
    SIZ(DEN(qz)) = 1;
    PTR(DEN(qz)) = &dummy;
    return mpq_cmp (q, qz);
  Do you mean something like that?


Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list