gam@astrovax.UUCP (Gary Mamon) (02/24/84)
If you thought you could get away using unoptimized f77 in UNIX 4.2, 
be careful! There are a few bugs. Here is a pretty serious one.
I am sorry that I am too ignorant in compilers to be able to suggest
a fix for it.
In double precision, if you raise an expression x to a variable power y, and
if the expression contains a power and at least another operation, then
Fortran "may" return y**y instead of x**y.
Here is a simple example:
	implicit real*8 (a-h,o-z)
c
111	continue
c
	print *,' enter x and y'
	read (5,*) x, y
c 
	z = (x**2.d0+1.d0)**(-y)
	anum = x**2.d0+1.d0
	power = -y
	z2 = anum**power
	print *,' x alph =',x,y
	print *,' anum power =',anum,power
	print *,' z z2 =',z,z2
c
	go to 111
	end
This program, compiled with no options, returns the wrong answer for z,
though z2 comes out correctly. Note that if the exponent is a constant 
(for example through a parameter statement), the answers are correct.
Gary Mamon				Princeton University, Astrophysics
{allegra,akgua,burl,cbosgd,decvax,ihnp4,kpno,princeton,vax135}!astrovax!gam