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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       div - compute the quotient and remainder of an integer division
13

SYNOPSIS

15       #include <stdlib.h>
16
17       div_t div(int numer, int denom);
18
19

DESCRIPTION

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

RETURN VALUE

29       The  div()  function shall return a structure of type div_t, comprising
30       both the quotient and the remainder. The structure includes the follow‐
31       ing members, in any order:
32
33
34              int  quot;  /* quotient */
35              int  rem;   /* remainder */
36

ERRORS

38       No errors are defined.
39
40       The following sections are informative.
41

EXAMPLES

43       None.
44

APPLICATION USAGE

46       None.
47

RATIONALE

49       None.
50

FUTURE DIRECTIONS

52       None.
53

SEE ALSO

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