Floor function for rationals available?

Marc Glisse marc.glisse at inria.fr
Mon Jun 22 18:57:54 UTC 2015

On Mon, 22 Jun 2015, Moritz Schmitt wrote:

> I am using GMP with C, and I am looking for a floor function for rationals,
> i.e., something like mpq_floor(). However, I can't seem to find it.
> Of course one could program such a function by hand by extracting the 
> nominator and denominator, dividing, comparing, etc. But is this really 
> the way to go?

What 'comparing' are you talking about? I would expect mpz_fdiv_q to give 
exactly what you are looking for.

Marc Glisse

More information about the gmp-discuss mailing list