This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: PR29335 evaluate transcendentals@compile-time using MPFR
On Wed, 11 Oct 2006, Kaveh R. GHAZI wrote:
> One of the issues I'm not sure about is how much MPFR precision I should
> request when initializing an MPFR variable via mpfr_init2(). Right now I
> simply hardcode 128 like the fortran front end does in
> arith.c:gfc_arith_init_1(). I also hardcode a buffer size of 256 in the
> intermediate string that holds values being converted between
> REAL_VALUE_TYPE and mpfr_t. See real_from_mpfr() and mpfr_from_real() in
> my original patch.
I'd say you should use the precision of the types being operated on. For
an operation on float, use the precision of float; for an operation on
double, use the precision of double; for an operation on long double, use
the precision of long double. This should also be the correct way to get
information from MPFR as to whether the result (rounded to the desired
precision) is exact.
Joseph S. Myers