7139 Sync mDNS with mDNSResponder-625.41.2
[unleashed.git] / usr / src / man / man3c / div.3c
blob245d04580318c3d0d00a72cc8163d1c12c1f2bad
1 '\" te
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"
8 .SH NAME
9 div, ldiv, lldiv \- compute the quotient and remainder
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <stdlib.h>
15 \fBdiv_t\fR \fBdiv\fR(\fBint\fR \fInumer\fR, \fBint\fR \fIdenom\fR);
16 .fi
18 .LP
19 .nf
20 \fBldiv_t\fR \fBldiv\fR(\fBlong int\fR \fInumer\fR, \fBlong int\fR \fIdenom\fR);
21 .fi
23 .LP
24 .nf
25 \fBlldiv_t\fR \fBlldiv\fR(\fBlong long\fR \fInumer\fR, \fBlong long\fR \fIdenom\fR);
26 .fi
28 .SH DESCRIPTION
29 .sp
30 .LP
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
40 \fInumer\fR.
41 .sp
42 .LP
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.
48 .SH RETURN VALUES
49 .sp
50 .LP
51 The \fBdiv()\fR function returns a structure of type \fBdiv_t\fR, comprising
52 both the quotient and remainder:
53 .sp
54 .in +2
55 .nf
56 int   quot;   /*quotient*/
57 int   rem;    /*remainder*/
58 .fi
59 .in -2
61 .sp
62 .LP
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:
66 .sp
67 .in +2
68 .nf
69 long int   quot;   /*quotient*/
70 long int   rem;    /*remainder*/
71 .fi
72 .in -2
74 .SH ATTRIBUTES
75 .sp
76 .LP
77 See \fBattributes\fR(5) for descriptions of the following attributes:
78 .sp
80 .sp
81 .TS
82 box;
83 c | c
84 l | l .
85 ATTRIBUTE TYPE  ATTRIBUTE VALUE
87 Interface Stability     Standard
89 MT-Level        MT-Safe
90 .TE
92 .SH SEE ALSO
93 .sp
94 .LP
95 \fBattributes\fR(5), \fBstandards\fR(5)