This is the mail archive of the gcc@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]

Re: How to determine that 2.0 == (float) 2 in a front-end.


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]