speed of mpq_cmp vs mpq_sub

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

Marc Glisse <marc.glisse at inria.fr> writes:

  It isn't just the case where the 2 denominators are equal, a large gcd
  is sufficient. In the example I posted, if I multiply the denominator
  of y by 3 and that of x by 5 (didn't check if that makes the mpq non
  canonical, but it shouldn't really matter), I still get sub in 1.8s
  and cmp in 25s.

That seems very odd.  How can sub be so fast?

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list