This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: PR29335 evaluate transcendentals at compile-time using MPFR

On 10/7/06, Joseph S. Myers <> wrote:
On Sat, 7 Oct 2006, Kaveh R. GHAZI wrote:

> Here's a proof-of-concept patch for PR middle-end/29335, evaluating
> transcendental functions at compile-time using MPFR.
> It'll depend on whether we include GMP/MPFR in the GCC repository as
> discussed here.  We either need to do that or add configure goo to detect
> if we have MPFR.  I'm in favor of including GMP/MPFR (but I need help!)
> The patch also needs testcases and more builtin functions to be converted.
> So far it does sin, cos and tan.  But I made it very easy to add more, you
> only need a couple of lines of code for each one.  The bulk of the work is
> done in do_mpfr_arg1 which should satisfy all one-argument math builtins.
> We can use it as a template for a do_mpfr_arg2 function for two-argument
> builtins when we do pow, etc.
> Thoughts?

I think doing this is a good idea.

If -frounding-math then it would be safest to disable the folding unless
MPFR tells you that the result is exact for that particular argument.
This is probably more significant for sqrt than for the transcendental
functions, since sqrt is an IEEE 754 operation that should follow the
rounding mode.  I think switching the sqrt implementation to use MPFR
would be a good idea, since the present one may not get the last bit right
for IEEE quad long double.

By making the decimal-to-binary conversion of floating-point constants use
MPFR we should be able to fix bug 21718.

Does it work correctly with cross-compiling and weird host/target float formats? If I remember correctly we still have real.c and not use mpfr just because of cross-compiling issues...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]