/
type: function (subr) location: built-in source file: xlmath.c Common LISP compatible: yes supported on: all machines
SYNTAX
(/ <expr1> ... )
<exprN> - integer or floating point number/expression
DESCRIPTION
The divide (/) function divides the first number in the list by the rest of the numbers in the list and returns the result. If all the expressions are integers, the division is integer division. If any expression is a floating point number, then the division will be floating point division.
EXAMPLES
(/ 1) ; returns 1 (/ 1 2) ; returns 0 (integer division) (float (/ 1 2)) ; returns 0 (integer division) (/ (float 1) 2) ; returns 0.5 (/ 1 1.0 2) ; returns 0.5 (short cut) (/ (float 1) 2 3) ; returns 0.166667 (/ 1 1.0 2 3 4) ; returns 0.0416667 (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) ; returns and prints 12.4138
COMMON LISP COMPATIBILITY: Common LISP supports a ratio data type. This means that (/ 3 4 5) will result in the value 3/20. In XLISP (/ 3 4 5) will result in 0 (because of integer values). (/ 3.0 4 5) will result in 0.15 for both XLISP and Common LISP.
NOTE: An easy way to force a sequence of integers to be divided as floating point numbers is to insert the number 1.0 after the first argument in the list of arguments to the divider function.