[net.lang.f77] Is x**i legal for all legal reals?

paul@oddjob.UChicago.UUCP (Paul Schinder) (12/16/84)

<>
I have had the dubious pleasure of trying to move fortran programs from a
Vax to an Apollo.  One of the problems which resulted in my groaning with
righteous indignation is that the Apollo ftn compiler refuses to allow me to
do x**i if x is a negative real and i is an integer (well, it works if the
integer is 2).  This behavior breaks A LOT of my code.  And so far as I
remembered, this was INCORRECT (not conforming to the standard) fortran.

Today I ran across an actual copy of the ANSI Fortran document which lays
out in gory detail Fortran 77.  Being sure of the high morality of my
position, I flipped to the section on exponentiation, only to discover that
it is unclear on this great question.  In fact, it seems to indicate that I
was wrong, since in the section describing primaries, one of the things a
primary can be is an *unsigned* arithmetic constant.  This seems silly at
best, since it is easy to do x**i, even if one wants to resort to using
logarithms, (Apollo compiler writers please take note) simply by storing the
sign of x beforehand and afterward checking whether or not i is odd or even.
The standard does, however, say that the integer power need not be converted
to the type of the primary, as it is in all other cases.

Does anyone out there know whether x**i is *supposed* to be legal for all
legal reals, even if the standard doesn't explicitly state this?  Is anyone
out there on the commitee which is defining the new standard for fortran?
Will this be cleared up in the new standard?  The Apollo is the *only*
machine I have ever used which exhibits this behavior, so I assume that even
if it is not explicitly stated in the standard, most people (including me,
and writers of compilers for Vaxen, IBM's, Cray's, FPS's, etc.) assume that
x**i is legal for all legal reals.
-- 


				Paul Schinder
				Astronomy and Astrophysics Center
				University of Chicago
				uucp: ..!ihnp4!oddjob!paul