Copyright © 1997 The Open Group

div - compute the quotient and remainder of an integer division

`#include <stdlib.h> div_t div(int`

numer, intdenom);

Thediv()function computes the quotient and remainder of the division of the numeratornumerby the denominatordenom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient. If the result cannot be represented, the behaviour is undefined; otherwise,quot * denom + remwill equalnumer.

Thediv()function returns a structure of typediv_t, comprising both the quotient and the remainder. The structure includes the following members, in any order:

int quot; /* quotient */ int rem; /* remainder */

No errors are defined.

None.

None.

None.

ldiv(),<stdlib.h>.

Derived from the ISO C standard.

Copyright © 1997 The Open Group

[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]