integer part of an mpf number

Patrick Pelissier patrick.pelissier at
Sat Mar 3 22:03:36 CET 2007


 mpz_set_f should be what you want.

 - Function: void mpz_set_f (mpz_t ROP, mpf_t OP)
     Set the value of ROP from OP.

     `mpz_set_d', `mpz_set_q' and `mpz_set_f' truncate OP to make it an

  Patrick Pelissier

On 3/3/07, Helmut Jarausch <jarausch at> wrote:
> Hi,
> I'm new to gmp and I couldn't find a means
> to get the integer part of a long float (mpf) number.
> Something like a cast  (mpz_t)( an_mpf_variable)
> There must be something like this (I'd like to use this
> to get a rational approximation with a given maximal length
> of the denominator)
> Many thanks for a hint,
> Helmut Jarausch
> Lehrstuhl fuer Numerische Mathematik
> RWTH - Aachen University
> D 52056 Aachen, Germany
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

More information about the gmp-discuss mailing list