/ ( x y -- z )
Factor documentation > Factor handbook > The language > Numbers > Arithmetic > Number protocol
Prev:* ( x y -- z )
Next:Division by zero


Vocabulary
math

Inputs and outputs
xa number
ya number
za number


Word description
Divides x by y, retaining as much precision as possible.
Division of fixnums may yield a ratio, or overflow and yield a bignum.
Division of bignums may yield a ratio.
Division of floats always yields a float.
Division of ratios and complex numbers proceeds using the relevant mathematical rules.


See also
Division by zero

Definition
IN: math

MATH: / ( x y -- z ) foldable flushable


Methods
USING: math math.complex.private ;

M: complex / [ / ] complex/ ; inline


USING: math math.private ;

M: float / float/f ; inline


USING: kernel math math.functions math.ratios
math.ratios.private ;

M: integer /
[ division-by-zero ] [
dup 0 < [ [ neg ] bi@ ] when 2dup fast-gcd [ /i ] curry
bi@ fraction>
] if-zero ;


USING: math math.ratios.private ;

M: ratio / scale / ;