Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
cl:expt
The cl:expt function computes the result of 'x' to
the power of 'y':
- (cl:expt base power)
- base - the base
power - the exponent
returns - the result of base to the power of power
(defun cl:expt (x y)
(let ((power (expt (float x) y)))
(if (and (integerp x) (integerp y))
(round power)
power)))
See and,
defun,
expt,
float,
if ,
integerp,
let,
power,
round.
The cl:expt function accepts integer and floating
point numbers as arguments. If both arguments are integer
numbers, the result will be an integer number, if one or both
arguments are floating-point numbers, the result will be a
floating-point number. In contrast to the
Nyquist/XLISP expt function, the
'cl:expt' function accepts exactly two arguments.
Back to top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference