XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

expt


Type:   -   function (subr)
Source:   -   xlmath.c

Syntax

(expt expr [power ... ])
expr - floating point number/expression
power - integer or floating point number/expression
returns - x to the y power

Description

The 'expt' function raises the 'expr' to the specified 'power' and returns the result. If there is no 'power' specified, the 'expr' is returned. If there are multiple 'powers', they will be applied sequentially to 'expr'.

Examples

(expt 2.0 2)        ; returns 4
(expt 2.0 10)       ; returns 1024
(expt 2 2)          ; error: bad integer operation
(expt 99.9)         ; returns 99.9
(expt 2.0 2.0 2.0)  ; returns 16

Note: 'expt' with a large values like (expt 999.9 999.9) causes an incorrect value to be generated, with no error. The returned value will be a very large floating point number near the computer's limit [something like 1.79000e+308].

See the expt function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next