The '/' function divides the first number given by the rest of the numbers 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.
(/ 1) => 1 (/ 1 2) => 0 ; integer division (float (/ 1 2)) => 0 ; integer division (/ (float 1) 2) => 0.5 ; type contagion (/ 1 1.0 2) => 0.5 ; type contagion (/ (float 1) 2 3) => 0.166667 ; type contagion (/ 1 1.0 2 3 4) => 0.0416667 ; type contagion
> (print (+ 1 2 (* 3.5 (/ 3.9 1.45)))) 12.4138 12.4138
See + , * , float, print. XLISP first prints the value on the screen, the second number is the return value.
In XLISP, the type contagion depends on the order of occurrence:
(/ 1 2 1.0) => 0 ; because (/ 1 2) => 0 and (/ 0 1.0) => 0.0 (/ 1.0 2 1) => 0.5 ; because (/ 1.0 2) => 0.5 and (/ 0.5 1) => 0.5
See also: