User Tools

Function EXP, EXPT


  • exp numberresult
  • expt base-number power-numberresult

Arguments and Values


exp and expt perform exponentiation.


exp has no branch cut.




expt is defined as bx = ex log b. This defines the principal values precisely. The range of expt is the entire complex plane. Regarded as a function of x, with b fixed, there is no branch cut. Regarded as a function of b, with x fixed, there is in general a branch cut along the negative real axis, continuous with quadrant II. The domain excludes the origin. By definition, 00 = 1. If b = 0 and the real part of x is strictly positive, then bx = 0. For all other values of x, 0x is an error. When power-number is an integer 0, then the result is always the value one in the type of base-number, even if the base-number is zero (of any type). That is: <blockquote> (expt x 0) ≡ (coerce 1 (type-of x)) </blockquote> If power-number is a zero of any other type, then the result is also the value one, in the type of the arguments after the application of the contagion rules in \secref\NumericContagionRules, with one exception: the consequences are undefined if base-number is zero when power-number is zero and not of type integer. ====Examples==== <blockquote> (exp 0) → 1.0 (exp 1) → 2.718282 (exp (log 5)) → 5.0 (expt 2 8) → 256 (expt 4 .5) → 2.0 (expt #c(0 1) 2) → -1 (expt #c(2 2) 3) → #C(-16 16) (expt #c(2 2) 4) → -64 </blockquote> ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * Function LOG * {\secref\FloatSubstitutability} ====Notes==== Implementations of expt are permitted to use different algorithms for the cases of a power-number of type rational and a power-number of type float. Note that by the following logic, (sqrt (expt x 3)) is not equivalent to (expt x 3/2)''.

(defparameter *x* (exp (/ (* 2 pi #c(0 1)) 3))) ; e2πi/3 (expt *x* 3) → 1 ; except for round-off error (sqrt (expt *x* 3)) → 1 ; except for round-off error (expt *x* 3/2) → -1 ; except for round-off error