Path: utzoo!attcan!uunet!yale!cmcl2!lanl!jlg
From: jlg@lanl.gov (Jim Giles)
Newsgroups: comp.lang.fortran
Subject: Re: intrinsic functions, math operators (was: i++, i+=1, i=i+1)
Message-ID: <4093@lanl.gov>
Date: 23 Sep 88 21:23:05 GMT
References: <596@convex.UUCP>
Organization: Los Alamos National Laboratory
Lines: 16

From article <596@convex.UUCP>, by dodson@mozart.uucp (Dave Dodson):
> [...]
> Considering the complexity and length of a properly written pow()
> routine, it does not appear to me to be practical for the compiler to
> in-line it.  [...]

pow(x,3) == x*x*x appears to me to be both accurate and short enough
to be expanded in-line.  The same goes for pow(x,-4.) == 1/((x*x)*(x*x).
_Most_ uses of the exponentiation operator in Fortran are of this kind.
Therefore, _most_ uses would benefit from in-line optimization.  Things
like pow(x,3.14159) could still call an external to solve - that's the
power of letting the compiler in on the semantics of the basic operations.


J. Giles
Los Alamos