speed of mpq_cmp vs mpq_sub
marc.glisse at inria.fr
Sun May 22 14:00:22 UTC 2016
On Sun, 22 May 2016, Torbjörn Granlund wrote:
> 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?
I am also surprised, but it is rather easy to reproduce. Maybe you'll see
a bug in my test program?
More information about the gmp-discuss