Floor function for rationals available?
    Moritz Schmitt 
    moritz at schmi.tt
       
    Mon Jun 22 19:32:37 UTC 2015
    
    
  
On Mon, Jun 22, 2015 at 08:57:54PM +0200, Marc Glisse 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.
You're right, mpz_fdiv_q seems to be what I want. I didn't read the
documentation well enough.
Thanks,
Moritz
    
    
More information about the gmp-discuss
mailing list