OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / div.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\"
28 .\" Modified 1993-03-29, David Metcalfe
29 .\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2002-08-10, 2003-11-01 Walter Harms, aeb
31 .\"
32 .\" Japanese Version Copyright (c) 1996 Kenji Kajiwara
33 .\"         all rights reserved.
34 .\" Translated Mon Jul 15 18:00:00 JST 1996
35 .\"         by Kenji Kajiwara
36 .\" Proof Reading: Takashi Yoshino
37 .\" Updated & Modified Sun May 30 13:03:43 JST 2004
38 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
39 .\"
40 .TH DIV 3 2007-07-26 "" "Linux Programmer's Manual"
41 .\"O .SH NAME
42 .SH Ì¾Á°
43 .\"O div, ldiv, lldiv, imaxdiv \- compute quotient and remainder of
44 .\"O an integer division
45 div, ldiv, lldiv, imaxdiv \- integer ·¿¤Î³ä»»¤Î¾¦¤È;¤ê¤ò·×»»¤¹¤ë
46 .\"O .SH SYNOPSIS
47 .SH ½ñ¼°
48 .nf
49 .B #include <stdlib.h>
50 .sp
51 .BI "div_t div(int " numerator ", int " denominator );
52 .br
53 .BI "ldiv_t ldiv(long " numerator ", long " denominator );
54 .br
55 .BI "lldiv_t lldiv(long long " numerator ", long long " denominator );
56 .sp
57 .B #include <inttypes.h>
58 .sp
59 .BI "imaxdiv_t imaxdiv(intmax_t " numerator ", intmax_t " denominator );
60 .fi
61 .sp
62 .in -4n
63 .\"O Feature Test Macro Requirements for glibc (see
64 .\"O .BR feature_test_macros (7)):
65 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
66 .RB ( feature_test_macros (7)
67 »²¾È):
68 .in
69 .sp
70 .BR lldiv ():
71 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
72 .I cc\ -std=c99
73 .\"O .SH DESCRIPTION
74 .SH ÀâÌÀ
75 .\"O The
76 .\"O .BR div ()
77 .\"O function computes the value
78 .\"O \fInumerator\fP/\fIdenominator\fP and
79 .\"O returns the quotient and remainder in a structure
80 .\"O named \fIdiv_t\fP that contains
81 .\"O two integer members (in unspecified order) named \fIquot\fP and \fIrem\fP.
82 .BR div ()
83 ´Ø¿ô¤Ï \fInumerator\fP/\fIdenominator\fP ¤ÎÃͤò·×»»¤¹¤ë¡£
84 ¾¦¤È;¤ê¤Ï¡¢
85 \fIquot\fP (¾¦) ¤È \fIrem\fP (;¤ê) ¤È¤¤¤¦Ì¾Á°¤Î 2 ¤Ä¤Î integer ·¿¥á¥ó¥Ð¤ò´Þ¤à
86 \fIdiv_t\fP ¤È¤¤¤¦¹½Â¤ÂΤÎÃæ¤ËÊÖ¤µ¤ì¤ë
87 (¥á¥ó¥Ð¤Î½çÈÖ¤ÏÉÔÄê¤Ç¤¢¤ë)¡£
88 .\"O The quotient is rounded towards zero.
89 ¾¦¤Ï 0 ¤Ë¶á¤¤Êý¤Ë´Ý¤á¤é¤ì¤ë¡£
90 .\"O The result satisfies \fIquot\fP*\fIdenominator\fP+\fIrem\fP = \fInumerator\fP.
91 ·ë²Ì¤Ï \fIquot\fP*\fIdenominator\fP+\fIrem\fP = \fInumerator\fP ¤òËþ¤¿¤¹¡£
92 .LP
93 .\"O The
94 .\"O .BR ldiv (),
95 .\"O .BR lldiv (),
96 .\"O and
97 .\"O .BR imaxdiv ()
98 .\"O functions do the same,
99 .\"O dividing numbers of the indicated type and
100 .\"O returning the result in a structure
101 .\"O of the indicated name, in all cases with fields \fIquot\fP and \fIrem\fP
102 .\"O of the same type as the function arguments.
103 .BR ldiv (),
104 .BR lldiv (),
105 .BR imaxdiv ()
106 ´Ø¿ô¤ÏƱÍͤÊÆ°ºî¤ò¤·¡¢
107 ¾å¤Ë¼¨¤·¤¿·¿¤Î¿ôÃͤò³ä»»¤·¤Æ¡¢¾å¤Ë¼¨¤·¤¿Ì¾Á°¤Î¹½Â¤ÂΤ˷ë²Ì¤òÊÖ¤¹¡£
108 ¤É¤Î¾ì¹ç¤Ç¤â¥Õ¥£¡¼¥ë¥É \fIquot\fP ¤È \fIrem\fP ¤Ï¡¢
109 ´Ø¿ô¤Î°ú¤­¿ô¤ÈƱ¤¸·¿¤Ç¤¢¤ë¡£
110 .\"O .SH "RETURN VALUE"
111 .SH ÊÖ¤êÃÍ
112 .\"O The \fIdiv_t\fP (etc.) structure.
113 \fIdiv_t\fP (¤Ê¤É¤Î) ¹½Â¤ÂΡ£
114 .\"O .SH "CONFORMING TO"
115 .SH ½àµò
116 SVr4, 4.3BSD, C89.
117 .\"O The functions
118 .\"O .BR lldiv ()
119 .\"O and
120 .\"O .BR imaxdiv ()
121 .\"O were added in C99.
122 ´Ø¿ô
123 .BR lldiv ()
124 ¤È
125 .BR imaxdiv ()
126 ¤Ï C99 ¤ËÄɲ䵤줿¡£
127 .\"O .SH EXAMPLE
128 .SH Îã
129 .\"O After
130 .nf
131
132         div_t q = div(\-5, 3);
133
134 .fi
135 .\"O the values \fIq.quot\fP and \fIq.rem\fP are \-1 and \-2, respectively.
136 ¤ò·×»»¤¹¤ë¤È¡¢\fIq.quot\fP ¤È \fIq.rem\fP ¤Ï¤½¤ì¤¾¤ì \-1 ¤È \-2 ¤Ë¤Ê¤ë¡£
137 .\"O .SH "SEE ALSO"
138 .SH ´ØÏ¢¹àÌÜ
139 .BR abs (3),
140 .BR remainder (3)