1LDIV(3P)                   POSIX Programmer's Manual                  LDIV(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       ldiv, lldiv - compute quotient and remainder of a long division
13

SYNOPSIS

15       #include <stdlib.h>
16
17       ldiv_t ldiv(long numer, long denom);
18       lldiv_t lldiv(long long numer, long long denom);
19
20

DESCRIPTION

22       These functions shall compute the quotient and remainder of  the  divi‐
23       sion  of  the numerator numer by the denominator denom. If the division
24       is inexact, the resulting quotient is the long integer (for the  ldiv()
25       function)  or  long  long  integer (for the lldiv() function) of lesser
26       magnitude that is the nearest to the algebraic quotient. If the  result
27       cannot   be   represented,   the   behavior  is  undefined;  otherwise,
28       quot * denom+rem shall equal numer.
29

RETURN VALUE

31       The ldiv() function shall return a structure of type ldiv_t, comprising
32       both  the  quotient  and the remainder. The structure shall include the
33       following members, in any order:
34
35
36              long   quot;    /* Quotient */
37              long   rem;     /* Remainder */
38
39       The lldiv() function shall return a structure of type lldiv_t, compris‐
40       ing  both  the  quotient and the remainder. The structure shall include
41       the following members, in any order:
42
43
44              long long   quot;    /* Quotient */
45              long long   rem;     /* Remainder */
46

ERRORS

48       No errors are defined.
49
50       The following sections are informative.
51

EXAMPLES

53       None.
54

APPLICATION USAGE

56       None.
57

RATIONALE

59       None.
60

FUTURE DIRECTIONS

62       None.
63

SEE ALSO

65       div(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdlib.h>
66
68       Portions of this text are reprinted and reproduced in  electronic  form
69       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
70       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
71       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
72       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
73       event of any discrepancy between this version and the original IEEE and
74       The Open Group Standard, the original IEEE and The Open Group  Standard
75       is  the  referee document. The original Standard can be obtained online
76       at http://www.opengroup.org/unix/online.html .
77
78
79
80IEEE/The Open Group                  2003                             LDIV(3P)
Impressum