Fortran standards, interpretations, etc. aside;
I have to disagree with the idea that (real) 0.0 to the (integer) 0 power
has a "definite mathematical meaning."
IT DOES NOT HAVE ANY "MATHEMATICAL MEANING" UNLESS YOU DECIDE TO GIVE IT A
"MEANING," and there is more than one "meaning" that could conceivably be
considered sensible.
It turns out to be a (usually) USEFUL CONVENTION to ignore the exponee (??)
when the exponent is integer zero. A useful rule would be: "Just look first
at the exponent and if it is integer zero don't look any further."
I agree that this is the "MOST OBVIOUS CHOICE," but it's not a mathematical
necessity. If you write a textbook or a compiler (or a standard) you are
free to say "for the purpose at hand, let us agree that ..." but MATHEMATICS
does not force the choice.
If you compute the function y = x ** 0 as (real) x goes continuously from
minus 1.0 to 1.0, you would definitely want y to be 1.0 whenever x is
positive or negative. So it would "make sense" to define the function to be
continuous at x=0.0 - but that's an extra part of the function definition,
and until you perform that extra step it is MATHEMATICALLY undefined.
If you take the sequence 0.0 ** n for n = (say) 5, 4, 3, 2, 1, 0, -1, -2,
etc you would definitely want zero for positive n and infinity for negative
n. So maybe you want something different for n=0 and there's nothing
inherently wrong about making it 1. (Unless for some reason you prefer zero
or infinity or something else.)
=
Back to the standards world, IEEE or Fortran or anybody else could
conceivably decree a value, and if there were a vote I suppose 1.0 would win
hands down.
But it's not a "mistake" to leave it undefined. And I don't think it's a
question of "interpretation" if the standard doesn't define it; As Van says,
the result of the interpretation process would essentially be, "The standard
doesn't define it."
Of course your program could make the test first, and "Just look first at
the exponent and if it is integer zero don't look any further." But
standards bodies have spent lots of time defining things so that such tests
are unnecessary. They just never did it for this one.
= Loren
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of
Neil N. Carlson
Sent: Wednesday, July 12, 2006 3:32 PM
To: [log in to unmask]
Subject: Re: Exponentiation in border cases
On Wed, 2006-07-12 at 15:55 -0600, James Giles wrote:
> Well, as I said before, if the Fortran standard doesn't say
> anything ...
But it does. It says that x**n should be "x raised to the power n"
and that has a very definite mathematical meaning when posed in the
context of integer powers. So I don't think this is merely a QoI
issue.
-Neil
--
Neil N. Carlson <[log in to unmask]>
|