Ciao Vincent, 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 > > int mpq_cmp_z(mpq_t, mpz_t)
Makes sense. > If you think that it would be a good addition, you might have a look in > the attached patch that was tested on the development version of GMP. I already have a similar function, I obtained it by pruning the mpq_cmp function, and you likely did the same, with an older version... I was waiting to propose, and commit it, because I'd like to overhaul many comparison function, maybe uniformly defining functions to test equality... and so on. But if you particularly need this function I think we can start by adding it. Comparing your code with mine, I see you added a couple of lines: if (!mpz_cmp_ui(mpq_denref(op), 1)) /* denominator 1 */ return mpz_cmp(mpq_numref(op), v); I'll test and add something equivalent. Regards, m -- http://bodrato.it/papers/ _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel