/
/ Function
Syntax:
/ number → reciprocal
/ numerator &rest denominators+ → quotient
Arguments and Values:
number, denominator—a non-zero number .
numerator, quotient, reciprocal—a number .
Description:
The function / performs division or reciprocation.
If no denominators are supplied, the function / returns the reciprocal of number.
If at least one denominator is supplied, the function / divides the numerator by all of the denominators and returns the resulting quotient.
If each argument is either an integer or a ratio, and the result is not an integer , then it is a ratio.
The function / performs necessary type conversions.
If any argument is a float then the rules of floating-point contagion apply; see Section 12.1.4 (Floating-point Computations).
Examples:
(/ 12 4) → 3
(/ 13 4) → 13/4
(/ -8) → -1/8
(/ 3 4 5) → 3/20
(/ 0.5) → 2.0
(/ 20 5) → 4
(/ 5 20) → 1/4
(/ 60 -2 3 5.0) → -2.0
(/ 2 #c(2 2)) → #C(1/2 -1/2)
Exceptional Situations:
The consequences are unspecified if any argument other than the first is zero. If there is only one argument, the consequences are unspecified if it is zero.
Might signal type-error if some argument is not a number . Might signal division-by-zero if division by zero is attempted. Might signal arithmetic-error.
See Also:
floor, ceiling, truncate, round
Expanded Reference: /
Reciprocal with a single argument
With one argument, / returns the reciprocal of the number.
(/ 2)
=> 1/2
(/ -8)
=> -1/8
(/ 0.5)
=> 2.0
Basic division
With two or more arguments, / divides the first argument by all subsequent arguments.
(/ 12 4)
=> 3
(/ 20 5)
=> 4
(/ 3 4 5)
=> 3/20
(/ 60 -2 3 5.0)
=> -2.0
Rational division
When dividing integers that do not divide evenly, the result is a ratio, not a truncated integer.
(/ 13 4)
=> 13/4
(/ 5 20)
=> 1/4
(/ 1 3)
=> 1/3
Floating-point division
When any argument is a float, the result is a float.
(/ 10.0 3)
=> 3.3333333
(/ 1 3.0)
=> 0.33333334
(/ 7.0d0 2)
=> 3.5d0
Complex division
/ handles complex numbers as well.
(/ #c(10 0) 2)
=> 5
(/ 2 #c(2 2))
=> #C(1/2 -1/2)
(/ #c(4.0 2.0) #c(1.0 1.0))
=> #C(3.0 -1.0)