[PATCH] Evaluate pow(x,n) at compile-time

Joseph S. Myers jsm28@cam.ac.uk
Mon Apr 14 16:52:00 GMT 2003

On Mon, 14 Apr 2003, Kaveh R. Ghazi wrote:

> If you reject a patch IMHO you need to provide a roadmap which leads
> towards acceptance.  I.e. tell Roger specifically what he needs to do
> in order to get it accepted.  If there is some subset-test or argument

I think it should use an existing implementation of correctly-rounded
arbitrary-precision floating-point functions.  The obvious one to use
would be mpfr in GMP.  (G95 already uses GMP.)  Accumulating new
implementations of floating-point functions - which are tricky to get
right, and have been implemented carefully before - is not a sensible
thing for GCC to do.

Where mpfr doesn't yet support any particular C99 <math.h> function we 
want to fold for constant arguments, an implementation should be 
contributed to GMP rather than adding a local one for GCC.  Likewise an 
implementation of whichever complex arithmetic functions we want to fold 
should be contributed to GMP rather than duplicated in GCC.

All functions folded should have testcases - both ones generated using the
generic program for finding cases where rounding is difficult, and, where
difficult examples can be found theoretically (as for sqrt), examples
found theoretically.

Joseph S. Myers

More information about the Gcc-patches mailing list