How to determine that 2.0 == (float) 2 in a front-end.
Toon Moene
toon@moene.indiv.nluug.nl
Thu Jun 27 15:00:00 GMT 2002
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)
More information about the Gcc
mailing list