Search                        Top                                  Index
HELP DIV                                Revised by A.Sloman March 1987

<number> div <number> -> <number>

DIV is an infix operator of precedence 2 which returns the integer part
of the quotient when one number divides another, e.g.

    10 div 3 =>
    ** 3

It could be defined in terms of "/" thus:

    define 2 x div y;
        lvars x,y;
        intof(x / y)
    enddefine;

DIV is now defined over all number data types (see HELP * MATH and
REF * NUMBERS) so it can be used with complex numbers, ratios, decimals,
etc. e.g.

    99.3 div 9 =>
    ** 11

    66_/5 div 3.0 =>
    ** 4

    44_+:5 div 2.0_+:3 =>
    ** 7_-:9

A fast non-checking procedure fi_div is provided for use with integers.
See REF * FASTPROCS for details

See also
HELP * REM - REM returns the remainder when one number divides another
HELP * MOD - Similar to REM. The help file explains the difference.