1DIV(P)                     POSIX Programmer's Manual                    DIV(P)
2
3
4

NAME

6       div - compute the quotient and remainder of an integer division
7

SYNOPSIS

9       #include <stdlib.h>
10
11       div_t div(int numer, int denom);
12
13

DESCRIPTION

15       The  div()  function  shall  compute  the quotient and remainder of the
16       division of the numerator numer by the denominator denom. If the  divi‐
17       sion is inexact, the resulting quotient is the integer of lesser magni‐
18       tude that is the nearest to the algebraic quotient. If the result  can‐
19       not  be represented, the behavior is undefined; otherwise, quot* denom+
20       rem shall equal numer.
21

RETURN VALUE

23       The div() function shall return a structure of type  div_t,  comprising
24       both the quotient and the remainder. The structure includes the follow‐
25       ing members, in any order:
26
27
28              int  quot;  /* quotient */
29              int  rem;   /* remainder */
30

ERRORS

32       No errors are defined.
33
34       The following sections are informative.
35

EXAMPLES

37       None.
38

APPLICATION USAGE

40       None.
41

RATIONALE

43       None.
44

FUTURE DIRECTIONS

46       None.
47

SEE ALSO

49       ldiv()  ,  the  Base  Definitions   volume   of   IEEE Std 1003.1-2001,
50       <stdlib.h>
51
53       Portions  of  this text are reprinted and reproduced in electronic form
54       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
55       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
56       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
57       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
58       event of any discrepancy between this version and the original IEEE and
59       The  Open Group Standard, the original IEEE and The Open Group Standard
60       is the referee document. The original Standard can be  obtained  online
61       at http://www.opengroup.org/unix/online.html .
62
63
64
65IEEE/The Open Group                  2003                               DIV(P)
Impressum