GMP precision with mpf_set_d

Jørgen Fulsebakke jorgen.fulsebakke at
Tue Jun 21 22:21:13 CEST 2011

Yeah what I meant (but didn't express clearly) was to compute cosine from
the mpf exponential functions, with input set with mpf_set_str. I'm using
loops but I could just convert the integer loop variable to a string inside
the loop. I will check out GNU MPFR, thanks!


2011/6/21 Zimmermann Paul <Paul.Zimmermann at>

>       Dear Jørgen,
> > So I can use mpf_set_str to get the desired precision. In the program I'm
> > writing I need to set mp variables to values I don't know beforehand but
> > compute by using double arithmetic. I guess I can e.g. compute a cosine
> > using the exponential definition, with inputs defined using mpf_set_str.
> if you compute a cosine using double arithmetic, there is no hope to get
> more accuracy than 53 bits, even with mpf_set_str. If you want more
> accuracy
> with elementary or special functions, you might want to use GNU MPFR to
> compute your cosine.
> Paul Zimmermann

More information about the gmp-discuss mailing list