Convert rational to fixed-point decimal number

Paul Zimmermann Paul.Zimmermann at loria.fr
Sun Feb 28 21:27:15 CET 2010


> > I try to use mpq_ functions in my program. How can I convert mpq_t
> > type to fixed-point decimal number without loss precision (without
> > using double IEEE)?
>   
> Torbjorn> I am not sure what function you need.
> 
> It sounds like what he wants gmp_printf(3).

maybe MPFR (www.mpfr.org) solves the original problem, more precisely the
mpfr_set_q function.

Paul Zimmermann

PS: www.mpfr.org is currently down, maybe due to the Xynthia storm.
You can also download MPFR from http://mpfr.gforge.inria.fr/.


More information about the gmp-discuss mailing list