Email list hosting service & mailing list manager


multiplicative inverse of 0.0 Aubrey Jaffer 22 Oct 2005 18:33 UTC

 | procedure: expt z1 z2
 |
 |     Returns z1 raised to the power z2. For nonzero z1
 |
 |     z1^z2 = e^(z2 log z1)
 |
 |     0^z is 1 if z = 0, and 0 if `(real-part z)' is positive.
 |     Otherwise, this procedure reports a violation of an
 |     implementation restriction or returns an unspecified number.

(expt x -1) is another way of writing (/ x);
(expt x -2) is (/ (expt x 2)); etc.
SRFI-77 specifies (/ 0.), but not (expt 0. -1).

SRFI-70's treatment of EXPT is consistent with `/' in this regard.
And this aspect was not controversial.

  For inexact arguments not both zero
  (define (expt z1 z2) (exp (* (if (zero? z1) (real-part z2) z2) (log z1))))

Why did SRFI-77 eschew SRFI-70's straightforward and safe
generalization of EXPT to (returning) -inf.0?

 | (expt 5 3)                  ==>  125
 | (expt 5 -3)                 ==>  1/125
 | (expt 5 0)                  ==>  1
 | (expt 0 5)                  ==>  0
 | (expt 0 5+.0000312i)        ==>  0
 | (expt 0 -5)                 ==>  unspecified
 | (expt 0 -5+.0000312i)       ==>  unspecified
 | (expt 0 0)                  ==>   [sic]

(expt 0 0) should return 1 (exact).

There was a discussion about this for srfi-73
(http://srfi.schemers.org/srfi-73/mail-archive/msg00007.html through
http://srfi.schemers.org/srfi-73/mail-archive/msg00011.html) and
srfi-70 (http://srfi.schemers.org/srfi-70/mail-archive/msg00090.html).

 | (expt 0.0 0.0)              ==>  1.0