# 0^0

• To: common-lisp at SU-AI
• Subject: 0^0
• From: Guy.Steele at CMU-CS-A
• Date: Thu, 02 Dec 1982 05:54:00 -0000

```Here's the scoop!  The exponentiation function has an essential singularity
at (0,0).  You can get 0^0 to equal any of an infinite number of values
by causing the limit to be computed by an approach from an appropriate
direction.  For example, LIM [x->0] x^x = 1 if x approaches 0 along
the real axis; but if it approaches along the imaginary axis, the limit
is e^(-pi/2), if I have done my calculations correctly.

Many languages define 0^0=1 because that preserves a number of interesting
identities that are more useful in practice than 0^x=0.  Kahan agrees with
that in his latest paper on branch cuts.

Kahan further assumes that, in languages that distinguish between 0 and 0.0
(which APL does not), the value 0 is likely to be exact, whereas the 0.0
might be exact or might be ther result of underflow.  This is why he
recommends 0^0 = 0.0^0 = 1 but 0.0^0 = 0.0^0.0 = error, because if the exponent
is the result of underflow then you get an anomaly; if only that
underflowed value had been preserved (call it EPS), then 0.0^EPS = 0.0,
not 1, and you don't want the problem of underflow to cause discontinuities
in the result.

On the other hand, I observe that there is an essential problem here: you
just can't tell whether a 0.0 is an exact value or not.  I am inclined
to let any zero raised to any zero be 1 or 1.0, as appropriate, in Common LISP.
--Guy

```