This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 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: Tim Josling <tej at melbpc dot org dot au>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 27 Jun 2002 22:59:32 +0200
- Subject: Re: How to determine that 2.0 == (float) 2 in a front-end.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <1025186349.2842.ezmlm@gcc.gnu.org> <3D1B7611.70A274B5@melbpc.org.au>
Tim Josling wrote:
> I have come across situations where for example 2.0 ** N where N > 240 was
> calculated by successive multiplications. This sort of calculation is common
> in net present value calculations, where you use binary search of Newton's
> method to zero in on the correct interest rate given a set of payments. This
> is terribly slow.
Yes, I know this and yes, f/com.c:ffecom_expr_power_integer_ doesn't
have any protection against it.
If it proves a problem in Fortran code, I trim it to some useful value.
The current discussion is whether:
x**6.0 can be rendered as x**6 (which is y=x*x, z=y*y, z=z*y).
--
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)