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

rem


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

Syntax

(rem expr1 ... )
exprN - integer number or expression
returns - the result of the remainder operation

Description

The 'rem' function takes the first pair of expressions and determines what is the remainder from dividing the first by the second expression. If there are no other arguments, this value is returned. If there are additional arguments, the remainder of the first pair is applied to the next and then the next and so on. In other words:

(REM A B C D)

is equivalent to:

(REM (REM (REM A B) C) D)

Examples

(rem 1)        ; returns 1
(rem 1 2)      ; returns 1
(rem 13 8)     ; returns 5
(rem 13 8 3)   ; returns 2
(rem 13.5 8)   ; error: bad floating point operation

Common Lisp: Common Lisp only allows two arguments. XLISP supports an arbitrary number of arguments. Also, Common Lisp allows for floating point expressions where XLISP does not support this.

See the rem function in the XLISP 2.0 manual.

  Back to Top


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