[gfortran,patch] Fix constant exponentiation with integer exponent

FX Coudert fxcoudert@gmail.com
Mon Mar 19 23:09:00 GMT 2007


Hi all,

This is a patch to fix PR 30834 by rewriting large parts of the  
complex_pow and gfc_arith_power functions (in arith.c) so that they  
handled arbitrarily large numbers (in mpz_t form). Complex  
exponentation is now done using the binary methode, like in the  
library. Real exponentiation is a simple call to mpfr_pow_z().  
Integer exponentiation needs more thinking, and I had to write many  
cases to get it right every single time (integer exponentiation with  
negative exponents shouldn't be allowed, let me tell you!)

The patch comes with somewhat long testcases. Regtested on i686- 
linux, OK for mainline? Do you think it's OK for 4.2? (I'm not sure,  
it's rather invasive... and the cases where the compiler actually got  
it wrong were... rather rarely used)

FX


:ADDPATCH fortran:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr30834_3.ChangeLog
Type: application/octet-stream
Size: 456 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070319/b85ba7dd/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr30834_3.diff
Type: application/octet-stream
Size: 15394 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070319/b85ba7dd/attachment-0001.obj>


More information about the Gcc-patches mailing list