speed of mpq_cmp vs mpq_sub

Torbjörn Granlund tg at gmplib.org
Sun May 22 11:58:35 UTC 2016


paul zimmermann <Paul.Zimmermann at inria.fr> writes:

  maybe mpq_cmp could first check if the denominators are equal, and in that
  case call mpz_cmp on the numerators, and in the other case do the expensive
  test I guess it is doing currently, i.e., a/b < c/d iff a*d < b*c. I guess
  some fast pre-test is done to check whether a*d and b*c could be in the same
  binade.
  
We already have a check for b = d = 1, and then invoke mpn_cmp.  We
should loosen that check to b = d.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list