2 .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH DIV 3C "Jul 24, 2002"
9 div, ldiv, lldiv \- compute the quotient and remainder
15 \fBdiv_t\fR \fBdiv\fR(\fBint\fR \fInumer\fR, \fBint\fR \fIdenom\fR);
20 \fBldiv_t\fR \fBldiv\fR(\fBlong int\fR \fInumer\fR, \fBlong int\fR \fIdenom\fR);
25 \fBlldiv_t\fR \fBlldiv\fR(\fBlong long\fR \fInumer\fR, \fBlong long\fR \fIdenom\fR);
31 The \fBdiv()\fR function computes the quotient and remainder of the division of
32 the numerator \fInumer\fR by the denominator \fIdenom\fR. It provides a
33 well-defined semantics for the signed integral division and remainder
34 operations, unlike the implementation-defined semantics of the built-in
35 operations. The sign of the resulting quotient is that of the algebraic
36 quotient, and if the division is inexact, the magnitude of the resulting
37 quotient is the largest integer less than the magnitude of the algebraic
38 quotient. If the result cannot be represented, the behavior is undefined;
39 otherwise, \fIquotient\fR * \fIdenom\fR + \fIremainder\fR will equal
43 The \fBldiv()\fR and \fBlldiv()\fR functions are similar to \fBdiv()\fR, except
44 that the arguments and the members of the returned structure are different.
45 The \fBldiv()\fR function returns a structure of type \fBldiv_t\fR and has type
46 \fBlong int\fR. The \fBlldiv()\fR function returns a structure of type
47 \fBlldiv_t\fR and has type \fBlong long\fR.
51 The \fBdiv()\fR function returns a structure of type \fBdiv_t\fR, comprising
52 both the quotient and remainder:
56 int quot; /*quotient*/
57 int rem; /*remainder*/
63 The \fBldiv()\fR function returns a structure of type \fBldiv_t\fR and
64 \fBlldiv()\fR returns a structure of type \fBlldiv_t\fR, comprising both the
65 quotient and remainder:
69 long int quot; /*quotient*/
70 long int rem; /*remainder*/
77 See \fBattributes\fR(5) for descriptions of the following attributes:
85 ATTRIBUTE TYPE ATTRIBUTE VALUE
87 Interface Stability Standard
95 \fBattributes\fR(5), \fBstandards\fR(5)