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] |

*From*: Toon Moene <toon at moene dot indiv dot nluug dot nl>*To*: FX Coudert <fxcoudert at gmail dot com>*Cc*: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>*Date*: Tue, 20 Mar 2007 20:41:52 +0100*Subject*: Re: [gfortran,patch] Fix constant exponentiation with integer exponent*References*: <EB425BFB-CDFC-451A-B300-B52DB5CA46EA@gmail.com>

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!)

This is what I wrote about it to the g77-bug mailing list on the 22nd of January, 1996:

This all sounds very reasonable, but it is plain wrong. In Fortran integers are _signed_ quantities in arithmetic context, so we have the following 5 x 5 matrix of possibilities for i ** j:

I hope I didn't make a mistake. In that case, row 1 and 5 can be folded, and row 2 can be dumbed down to -1 for j odd and +1 for j even. The remaining i**j case can be implemented with the loop as generated by g77 now (see my previous mail).

Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290

Saturnushof 14, 3738 XG Maartensdijk, The Netherlands

At home: http://moene.indiv.nluug.nl/~toon/

Who's working on GNU Fortran: http://gcc.gnu.org/ml/gcc/2007-01/msg00059.html

**Follow-Ups**:**Re: [gfortran,patch] Fix constant exponentiation with integer exponent***From:*François-Xavier Coudert

**References**:**[gfortran,patch] Fix constant exponentiation with integer exponent***From:*FX Coudert

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |