1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
30 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
31 .\" Modified 2002-08-10 Walter Harms
32 .\" (walter.harms@informatik.uni-oldenburg.de)
33 .\" Modified 2003-11-18, 2004-10-05 aeb
35 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
36 .\" and Copyright (c) 2008 Akihiro MOTOKI
37 .\" Translated 2004-09-02, Yuichi SATO <ysato444@yahoo.co.jp>
38 .\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
39 .\" Modified 2005-02-26, Yuichi SATO <ysato444@yahoo.co.jp>
40 .\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .TH REMAINDER 3 2009-02-04 "" "Linux Programmer's Manual"
45 .\"O drem, dremf, dreml, remainder, remainderf, remainderl \- \
46 .\"O floating-point remainder function
47 drem, dremf, dreml, remainder, remainderf, remainderl \- ÉâÆ°¾®¿ôÅÀ¾ê;´Ø¿ô
53 .\"O /* The C99 versions */
55 .BI "double remainder(double " x ", double " y );
56 .BI "float remainderf(float " x ", float " y );
57 .BI "long double remainderl(long double " x ", long double " y );
59 .\"O /* Obsolete synonyms */
61 .BI "double drem(double " x ", double " y );
62 .BI "float dremf(float " x ", float " y );
63 .BI "long double dreml(long double " x ", long double " y );
66 .\"O Link with \fI\-lm\fP.
67 \fI\-lm\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
70 .\"O Feature Test Macro Requirements for glibc (see
71 .\"O .BR feature_test_macros (7)):
72 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
73 .RB ( feature_test_macros (7)
79 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE; or
84 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
90 _SVID_SOURCE || _BSD_SOURCE
96 .\"O function computes the remainder of dividing
105 ¤Ç³ä¤Ã¤¿Í¾¤ê¤ò·×»»¤¹¤ë¡£
106 .\"O The return value is
107 .\"O \fIx\fP\-\fIn\fP*\fIy\fP,
112 .\"O rounded to the nearest integer.
114 \fIx\fP\-\fIn\fP*\fIy\fP
120 ¤ÎÃͤòºÇ¤â¶á¤¤À°¿ô¤Ë´Ý¤á¤¿¤â¤Î¤Ç¤¢¤ë¡£
121 .\"O If the absolute value of
122 .\"O \fIx\fP\-\fIn\fP*\fIy\fP
125 .\"O is chosen to be even.
126 \fIx\fP\-\fIn\fP*\fIy\fP
127 ¤ÎÀäÂÐÃͤ¬ 0.5 ¤Î¾ì¹ç¡¢¶ö¿ô¤Ë¤Ê¤ë¤è¤¦¤Ë
131 .\"O These functions are unaffected by the current rounding mode (see
133 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢¸½ºß¤Î´Ý¤á¥â¡¼¥É¤Î±Æ¶Á¤ò¼õ¤±¤Ê¤¤ (´Ý¤á¥â¡¼¥É¤Ë¤Ä¤¤¤Æ¤Ï
139 .\"O function does precisely the same thing.
141 ´Ø¿ô¤Ï¤³¤ì¤ÈÁ´¤¯Æ±¤¸Æ°ºî¤ò¤¹¤ë¡£
142 .\"O .SH "RETURN VALUE"
144 .\"O On success, these
145 .\"O functions return the floating-point remainder,
146 .\"O \fIx\fP\-\fIn\fP*\fIy\fP.
147 .\"O If the return value is 0, it has the sign of
149 À®¸ù¤¹¤ë¤È¡¢¤³¤ì¤é¤Î´Ø¿ô¤ÏÉâÆ°¾®¿ôÅÀ¤Î¾ê; \fIx\fP\-\fIn\fP*\fIy\fP ¤òÊÖ¤¹¡£
150 ÊÖ¤êÃͤ¬ 0 ¤Î¾ì¹ç¡¢¤½¤ÎÉä¹æ¤Ï
158 .\"O is a NaN, a NaN is returned.
162 ¤¬ NaN ¤Î¾ì¹ç¡¢NaN ¤¬ÊÖ¤µ¤ì¤ë¡£
170 .\"O a domain error occurs, and
171 .\"O a NaN is returned.
176 Îΰ襨¥é¡¼ (domain error) ¤¬È¯À¸¤·¡¢NaN ¤¬ÊÖ¤µ¤ì¤ë¡£
181 .\" FIXME . Instead, glibc gives a domain error even if x is a NaN
185 .\" Interestingly, remquo(3) does not have the same problem.
186 .\"O a domain error occurs, and
187 .\"O a NaN is returned.
192 Îΰ襨¥é¡¼¤¬È¯À¸¤·¡¢NaN ¤¬ÊÖ¤µ¤ì¤ë¡£
196 .\"O .BR math_error (7)
197 .\"O for information on how to determine whether an error has occurred
198 .\"O when calling these functions.
199 ¤³¤ì¤é¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤ÎȽÄêÊýË¡¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤Ï
203 .\"O The following errors can occur:
204 °Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ¤¬¤¢¤ë¡£
206 .\"O Domain error: \fIx\fP is an infinity and \fIy\fP is not a NaN
207 Îΰ襨¥é¡¼ (domain error): \fIx\fP ¤¬Ìµ¸ÂÂç¤Ç \fIy\fP ¤¬ NaN ¤Ç¤Ï¤Ê¤¤
211 .\"O An invalid floating-point exception
212 .\"O .RB ( FE_INVALID )
214 ÉÔÀµ (invalid) ÉâÆ°¾®¿ôÅÀÎã³°
218 .\"O These functions do not set
221 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢¤³¤Î¾ì¹ç¤Ë
224 .\" FIXME . Is it intentional that these functions do not set errno?
225 .\" They do set errno for the y == 0 case, below.
226 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6783
228 .\"O Domain error: \fIy\fP is zero\" [XXX see bug above] and \fIx\fP is not a NaN
229 Îΰ襨¥é¡¼: \fIy\fP ¤¬¥¼¥í¤Ç \fIx\fP ¤¬ NaN ¤Ç¤Ï¤Ê¤¤ (²¼µ¤Î¡Ö¥Ð¥°¡×»²¾È)
233 .\"O An invalid floating-point exception
234 .\"O .RB ( FE_INVALID )
240 ÉÔÀµ (invalid) ÉâÆ°¾®¿ôÅÀÎã³°
243 .\"O .SH "CONFORMING TO"
247 .\"O .BR remainder (),
248 .\"O .BR remainderf (),
250 .\"O .BR remainderl ()
251 .\"O are specified in C99 and POSIX.1-2001.
256 ¤Ï C99 ¤È POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
264 .\"O .I "long double"
269 .\"O exist on some systems, such as Tru64 and glibc2.
270 .\"O Avoid the use of these functions in favor of
271 .\"O .BR remainder ()
275 ¤Ï 4.3BSD ¤ËͳÍ褹¤ë¡£
283 ¤Ï¡¢Tru64 ¤ä glibc2 ¤Î¤è¤¦¤Ê¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ë¸ºß¤¹¤ë¡£
284 ¤³¤ì¤é¤Î´Ø¿ô¤Î»ÈÍѤÏÈò¤±¤Æ¡¢
291 .\"O remainder(nan(""), 0);
293 .\"O returns a NaN, as expected, but wrongly causes a domain error;
294 .\"O it should yield a silent NaN.
296 remainder(nan(""), 0);
298 ¤Î¸Æ¤Ó½Ð¤·¤ò¹Ô¤¦¤È¡¢´üÂÔÄ̤ê Nan ¤¬Ê֤뤬¡¢¸í¤Ã¤ÆÎΰ襨¥é¡¼¤¬È¯À¸¤¹¤ë¡£
299 Àµ¤·¤¯¤Ï¥¨¥é¡¼¤Ê¤·¤Î Nan ¤È¤Ê¤ë¤Ù¤¤Ç¤¢¤ë¡£
300 .\" FIXME . this bug occurs as at glibc 2.8.
301 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6779
304 .\"O The call "remainder(29.0, 3.0)" returns \-1.
305 "remainder(29.0, 3.0)" ¤ò¸Æ¤Ó½Ð¤¹¤È \-1 ¤òÊÖ¤¹¡£