This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to determine that 2.0 == (float) 2 in a front-end.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 25 Jun 2002 23:56:01 +0200
- Subject: How to determine that 2.0 == (float) 2 in a front-end.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
L.S.,
Fortran sports this strange fiction that X**2.0 is the same as X**2 is
the same as X*X (for those interested I can explain). This turns out to
be an interesting optimisation I might be able to implement in the
Fortran front-end.
Obviously, because X**Y, with Y real, is implemented by computing
EXP(Y*LOG*(X)) one doesn't want to change 2.0 to 2 lightly (i.e.,
without the assurance of -funsafe-math_optimizations).
That aside, what is the procedure a front-end has to follow to determine
that a constant A (some float mode) is in fact "equal" to a constant I
(some integer mode) ?
Thanks in advance,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)