GMP precision with mpf_set_d

Zimmermann Paul Paul.Zimmermann at
Tue Jun 21 22:07:23 CEST 2011

       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