OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / rint.3
1 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
26 .\" and Copyright (c) 2008 Akihiro MOTOKI
27 .\" Translated Tue Jan 21 20:52:09 JST 1997
28 .\"       by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
29 .\" Updated & Modified Fri Jul  6 20:42:59 JST 2001
30 .\"       by Yuichi SATO <ysato@h4.dion.ne.jp>
31 .\" Updated & Modified Sun Jan 16 07:40:37 JST 2005
32 .\"       by Yuichi SATO <ysato444@yahoo.co.jp>
33 .\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\"
35 .\"WORD:        mantissa                ²¾¿ô
36 .\"
37 .TH RINT 3  2010-09-20 "" "Linux Programmer's Manual"
38 .\"O .SH NAME
39 .SH Ì¾Á°
40 .\"O nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- round
41 .\"O to nearest integer
42 nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- ºÇ¤â¶á¤¤À°¿ô¤Ë´Ý¤á¤ë
43 .\"O .SH SYNOPSIS
44 .SH ½ñ¼°
45 .nf
46 .B #include <math.h>
47 .sp
48 .BI "double nearbyint(double " x );
49 .br
50 .BI "float nearbyintf(float " x );
51 .br
52 .BI "long double nearbyintl(long double " x );
53 .sp
54 .BI "double rint(double " x );
55 .br
56 .BI "float rintf(float " x );
57 .br
58 .BI "long double rintl(long double " x );
59 .fi
60 .sp
61 .\"O Link with \fI\-lm\fP.
62 \fI\-lm\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
63 .sp
64 .in -4n
65 .\"O Feature Test Macro Requirements for glibc (see
66 .\"O .BR feature_test_macros (7)):
67 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
68 .RB ( feature_test_macros (7)
69 »²¾È):
70 .in
71 .sp
72 .ad l
73 .BR nearbyint (),
74 .BR nearbyintf (),
75 .BR nearbyintl ():
76 .RS 4
77 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L || _ISOC99_SOURCE;
78 .br
79 or
80 .I cc\ -std=c99
81 .RE
82 .br
83 .BR rint ():
84 .RS 4
85 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
86 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE ||
87 _POSIX_C_SOURCE\ >=\ 200112L;
88 .br
89 or
90 .I cc\ -std=c99
91 .RE
92 .br
93 .BR rintf (),
94 .BR rintl ():
95 .RS 4
96 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
97 _POSIX_C_SOURCE\ >=\ 200112L;
98 .br
99 or
100 .I cc\ -std=c99
101 .RE
102 .ad b
103 .\"O .SH DESCRIPTION
104 .SH ÀâÌÀ
105 .\"O The
106 .\"O .BR nearbyint ()
107 .\"O functions round their argument to an integer value in floating-point
108 .\"O format, using the current rounding direction (see
109 .\"O .BR fesetround (3))
110 .\"O and without raising the
111 .\"O .I inexact
112 .\"O exception.
113 .BR nearbyint ()
114 ´Ø¿ô·²¤Ï¡¢¸½ºß¤Î´Ý¤áÊý¸þ
115 .RB ( fesetround (3)
116 »²¾È) ¤Ç°ú¤­¿ô¤òÉâÆ°¾®¿ôÅÀ·Á¼°¤ÎÀ°¿ô¤Ë´Ý¤á¤ë¡£
117 .I inexact
118 Îã³°¤ò½Ð¤µ¤Ê¤¤¡£
119 .LP
120 .\"O The
121 .\"O .BR rint ()
122 .\"O functions do the same, but will raise the
123 .\"O .I inexact
124 .\"O exception
125 .\"O .RB ( FE_INEXACT ,
126 .\"O checkable via
127 .\"O .BR fetestexcept (3))
128 .\"O when the result differs in value from the argument.
129 .BR rint ()
130 ´Ø¿ô·²¤âƱ¤¸¤è¤¦¤ÊÆ°ºî¤ò¤¹¤ë¤¬¡¢
131 ·ë²Ì¤¬°ú¤­¿ô¤È°Û¤Ê¤ë¾ì¹ç¤Ë
132 .I inexact
133 Îã³°
134 .RB ( FE_INEXACT )
135 ¤ò½Ð¤¹ (¤³¤ÎÎã³°¤Ï
136 .BR fetestexcept (3)
137 ·Ðͳ¤Ç³Îǧ²Äǽ)¡£
138 .\"O .SH "RETURN VALUE"
139 .SH ÊÖ¤êÃÍ
140 .\"O These functions return the rounded integer value.
141 ¤³¤ì¤é¤Î´Ø¿ô¤Ï´Ý¤á¤¿À°¿ôÃͤòÊÖ¤¹¡£
142
143 .\"O If \fIx\fP is integral, +0, \-0, NaN, or infinite,
144 .\"O \fIx\fP itself is returned.
145 \fIx\fP ¤¬À°¿ô¡¢+0¡¢\-0¡¢NaN¡¢Ìµ¸ÂÂç¤Î¤¤¤º¤ì¤«¤Î¾ì¹ç¡¢
146 \fIx\fP ¤½¤Î¤â¤Î¤òÊÖ¤¹¡£
147 .\"O .SH ERRORS
148 .SH ¥¨¥é¡¼
149 .\"O No errors occur.
150 ¥¨¥é¡¼¤ÏȯÀ¸¤·¤Ê¤¤¡£
151 .\"O POSIX.1-2001 documents a range error for overflows, but see NOTES.
152 POSIX.1-2001 ¤Ë¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Ç¤ÎÈÏ°Ï¥¨¥é¡¼ (range error) ¤Î
153 µ­ºÜ¤¬¤¢¤ë¡£¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È¤Î¤³¤È¡£
154 .\"O .SH "CONFORMING TO"
155 .SH ½àµò
156 C99, POSIX.1-2001.
157 .\"O .SH NOTES
158 .SH Ãí°Õ
159 .\"O SUSv2 and POSIX.1-2001 contain text about overflow (which might set
160 .\"O .I errno
161 .\"O to
162 .\"O .BR ERANGE ,
163 .\"O or raise an
164 .\"O .B FE_OVERFLOW
165 .\"O exception).
166 SUSv2 ¤È POSIX.1-2001 ¤Ë¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Ë´Ø¤¹¤ëµ­½Ò¤¬¤¢¤ê¡¢
167 ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Î¾ì¹ç¤Ë¤Ï¡¢
168 .I errno
169 ¤ò
170 .B ERANGE
171 ¤ËÀßÄꤹ¤ë¤«¡¢
172 .B FE_OVERFLOW
173 Îã³°¤òȯÀ¸¤¹¤ë¤³¤È¤È¤µ¤ì¤Æ¤¤¤ë¡£
174 .\"O In practice, the result cannot overflow on any current machine,
175 .\"O so this error-handling stuff is just nonsense.
176 ¼ÂºÝ¤Î¤È¤³¤í¡¢¤É¤Î¸½¹Ô¤Î¥Þ¥·¥ó¤Ç¤â·ë²Ì¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤òµ¯¤³¤¹¤³¤È¤Ï¤Ê¤¤¤Î¤Ç¡¢
177 ¤³¤Î¥¨¥é¡¼½èÍý¤Ï°ÕÌ£¤¬¤Ê¤¤¡£
178 .\"O (More precisely, overflow can happen only when the maximum value
179 .\"O of the exponent is smaller than the number of mantissa bits.
180 .\"O For the IEEE-754 standard 32-bit and 64-bit floating-point numbers
181 .\"O the maximum value of the exponent is 128 (respectively, 1024),
182 .\"O and the number of mantissa bits is 24 (respectively, 53).)
183 (¤è¤êÀµ³Î¤Ë¸À¤¦¤È¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Ï»Ø¿ôÉô¤ÎºÇÂçÃͤ¬
184 ²¾¿ôÉô¤òɽ¤¹¥Ó¥Ã¥È¤Î¿ô¤è¤ê¾®¤µ¤¤¾ì¹ç¤Ë¤·¤«µ¯¤³¤é¤Ê¤¤¡£
185 IEEE-754 µ¬³Ê¤Î 32 ¥Ó¥Ã¥È¤È 64 ¥Ó¥Ã¥È¤ÎÉâÆ°¾®¿ô¤Ç¤Ï¡¢
186 »Ø¿ôÉô¤ÎºÇÂçÃͤϤ½¤ì¤¾¤ì 128 ¤È 1024 ¤Ç¤¢¤ê¡¢
187 ²¾¿ôÉô¤Î¥Ó¥Ã¥È¿ô¤Ï¤½¤ì¤¾¤ì 24 ¤È 53 ¤Ç¤¢¤ë¡£)
188
189 .\"O If you want to store the rounded value in an integer type,
190 .\"O you probably want to use one of the functions described in
191 .\"O .BR lrint (3)
192 .\"O instead.
193 ´Ý¤á¤¿ÃͤòÀ°¿ô·¿¤Ë³ÊǼ¤·¤¿¾ì¹ç¤Ë¤Ï¡¢¤ª¤½¤é¤¯¤³¤Î´Ø¿ô¤Ç¤Ï¤Ê¤¯
194 .BR lrint (3)
195 ¤ËºÜ¤Ã¤Æ¤¤¤ë´Ø¿ô¤Î¤É¤ì¤«¤ò»È¤¤¤¿¤¤¤Î¤À¤í¤¦¡£
196 .\"O .SH "SEE ALSO"
197 .SH ´ØÏ¢¹àÌÜ
198 .BR ceil (3),
199 .BR floor (3),
200 .BR lrint (3),
201 .BR round (3),
202 .BR trunc (3)