This is the mail archive of the gcc-patches@gcc.gnu.org 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 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!)
> http://gcc.gnu.org/ml/gcc/2006-10/msg00136.html
> 
> 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.

-- 
Joseph S. Myers
joseph@codesourcery.com


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