OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / hypot.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 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified 2002-07-27 by Walter Harms
29 .\"     (walter.harms@informatik.uni-oldenburg.de)
30 .\"
31 .\" Japanese Version Copyright (c) 1996 Kenji Kajiwara
32 .\"         all rights reserved.
33 .\" Translated Mon Jul 15 18:20:00 JST 1996
34 .\"         by Kenji Kajiwara
35 .\" Proof Reading: Takashi Yoshino
36 .\" Updated & Modified Sun Jun  6 05:30:45 JST 2004
37 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
38 .\" Updated & Modified Sat Jan 15 02:32:55 JST 2005 by Yuichi SATO
39 .\" Updated 2008-09-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\"
41 .TH HYPOT 3 2010-09-20 ""  "Linux Programmer's Manual"
42 .\"O .SH NAME
43 .SH Ì¾Á°
44 .\"O hypot, hypotf, hypotl \- Euclidean distance function
45 hypot, hypotf, hypotl \- ¥æ¡¼¥¯¥ê¥Ã¥Éµ÷Î¥´Ø¿ô
46 .\"O .SH SYNOPSIS
47 .SH ½ñ¼°
48 .nf
49 .B #include <math.h>
50 .sp
51 .BI "double hypot(double " x ", double " y );
52 .br
53 .BI "float hypotf(float " x ", float " y );
54 .br
55 .BI "long double hypotl(long double " x ", long double " y );
56 .fi
57 .sp
58 .\"O Link with \fI\-lm\fP.
59 \fI\-lm\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
60 .sp
61 .in -4n
62 .\"O Feature Test Macro Requirements for glibc (see
63 .\"O .BR feature_test_macros (7)):
64 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
65 .RB ( feature_test_macros (7)
66 »²¾È):
67 .in
68 .sp
69 .ad l
70 .BR hypot ():
71 .RS 4
72 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE ||
73 _POSIX_C_SOURCE\ >=\ 200112L;
74 .br
75 or
76 .I cc\ -std=c99
77 .RE
78 .br
79 .BR hypotf (),
80 .BR hypotl ():
81 .RS 4
82 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
83 _POSIX_C_SOURCE\ >=\ 200112L;
84 .br
85 or
86 .I cc\ -std=c99
87 .RE
88 .ad b
89 .\"O .SH DESCRIPTION
90 .SH ÀâÌÀ
91 .\"O The
92 .\"O .BR hypot ()
93 .\"O function returns
94 .\"O .RI sqrt( x * x + y * y ).
95 .BR hypot ()
96 ´Ø¿ô¤Ï
97 .RI sqrt( x * x + y * y )
98 ¤ÎÃͤòÊÖ¤¹¡£
99 .\"O This is the length of the hypotenuse of a right-angled triangle
100 .\"O with sides of length
101 .\"O .I x
102 .\"O and
103 .\"O .IR y ,
104 .\"O or the distance of the point
105 .\"O .RI ( x , y )
106 .\"O from the origin.
107 ¤³¤ì¤Ï
108 ľ³Ñ¤ò¶´¤à 2 ÊÕ¤ÎŤµ¤¬
109 .I x
110 ¤È
111 .I y
112 ¤Ç¤¢¤ëľ³Ñ»°³Ñ·Á¤Î¼ÐÊÕ¤ÎŤµ¡¢
113 ¤¹¤Ê¤ï¤Á¡¢¸¶ÅÀ¤ÈÅÀ
114 .RI ( x , y )
115 ¤È¤Îµ÷Î¥¤Ç¤¢¤ë¡£
116
117 .\"O The calculation is performed without undue overflow or underflow
118 .\"O during the intermediate steps of the calculation.
119 ·×»»¤ÎÃæ´Ö¥¹¥Æ¥Ã¥×¤Ç¤Ï¡¢É¬Íװʾå¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤ä¥¢¥ó¥À¡¼¥Õ¥í¡¼¤¬
120 µ¯¤­¤Ê¤¤¤è¤¦¤Ë¤·¤Æ·×»»¤¬¼Â¹Ô¤µ¤ì¤ë¡£
121 .\" e.g., hypot(DBL_MIN, DBL_MIN) does the right thing, as does, say
122 .\" hypot(DBL_MAX/2.0, DBL_MAX/2.0).
123 .\"O .SH RETURN VALUE
124 .SH ÊÖ¤êÃÍ
125 .\"O On success, these functions return the length of a right-angled triangle
126 .\"O with sides of length
127 .\"O .I x
128 .\"O and
129 .\"O .IR y .
130 À®¸ù¤¹¤ë¤È¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢
131 ľ³Ñ¤ò¶´¤à 2 ÊÕ¤ÎŤµ¤¬
132 .I x
133 ¤È
134 .I y
135 ¤Ç¤¢¤ëľ³Ñ»°³Ñ·Á¤Î¼ÐÊÕ¤ÎŤµ¤òÊÖ¤¹¡£
136
137 .\"O If
138 .\"O .I x
139 .\"O or
140 .\"O .I y
141 .\"O is an infinity,
142 .\"O positive infinity is returned.
143 .I x
144 ¤«
145 .I y
146 ¤¬Ìµ¸ÂÂç¤Î¾ì¹ç¡¢Àµ¤Î̵¸ÂÂ礬ÊÖ¤µ¤ì¤ë¡£
147
148 .\"O If
149 .\"O .I x
150 .\"O or
151 .\"O .I y
152 .\"O is a NaN,
153 .\"O and the other argument is not an infinity,
154 .\"O a NaN is returned.
155 .I x
156 ¤«
157 .I y
158 ¤Î°ìÊý¤¬ NaN ¤Ç¡¢¤â¤¦°ìÊý¤¬Ìµ¸ÂÂç¤Ç¤Ê¤¤¾ì¹ç¡¢
159 NaN ¤¬ÊÖ¤µ¤ì¤ë¡£
160
161 .\"O If the result overflows,
162 .\"O a range error occurs,
163 .\"O and the functions return
164 .\"O .BR HUGE_VAL ,
165 .\"O .BR HUGE_VALF ,
166 .\"O or
167 .\"O .BR HUGE_VALL ,
168 .\"O respectively.
169 ·ë²Ì¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤¹¤ë¾ì¹ç¡¢ÈÏ°Ï¥¨¥é¡¼ (range error) ¤¬È¯À¸¤·¡¢
170 ³Æ´Ø¿ô¤Ï¤½¤ì¤¾¤ì
171 .BR HUGE_VAL ,
172 .BR HUGE_VALF ,
173 .B HUGE_VALL
174 ¤òÊÖ¤¹¡£
175
176 .\"O If both arguments are subnormal, and the result is subnormal,
177 ξÊý¤Î°ú¤­¿ô¤¬ÈóÀµµ¬²½¿ô (subnormal) ¤Ç¡¢·ë²Ì¤âÈóÀµµ¬²½¿ô (subnormal) ¤Î¾ì¹ç¡¢
178 .\" Actually, could the result not be subnormal if both arguments
179 .\" are subnormal?  I think not -- mtk, Jul 2008
180 .\"O a range error occurs,
181 .\"O and the correct result is returned.
182 ÈÏ°Ï¥¨¥é¡¼¤¬È¯À¸¤·¡¢Àµ¤·¤¤·ë²Ì¤¬ÊÖ¤µ¤ì¤ë¡£
183 .\"O .SH ERRORS
184 .SH ¥¨¥é¡¼
185 .\"O See
186 .\"O .BR math_error (7)
187 .\"O for information on how to determine whether an error has occurred
188 .\"O when calling these functions.
189 ¤³¤ì¤é¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤ÎȽÄêÊýË¡¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤Ï
190 .BR math_error (7)
191 ¤ò»²¾È¤Î¤³¤È¡£
192 .PP
193 .\"O The following errors can occur:
194 °Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
195 .TP
196 .\"O Range error: result overflow
197 ÈÏ°Ï¥¨¥é¡¼: ·ë²Ì¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼
198 .\"O .I errno
199 .\"O is set to
200 .\"O .BR ERANGE .
201 .\"O An overflow floating-point exception
202 .\"O .RB ( FE_OVERFLOW )
203 .\"O is raised.
204 .I errno
205 ¤Ë
206 .B ERANGE
207 ¤¬ÀßÄꤵ¤ì¤ë¡£
208 ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼ÉâÆ°¾®¿ôÅÀÎã³°
209 .RB ( FE_OVERFLOW )
210 ¤¬¾å¤¬¤ë¡£
211 .TP
212 .\"O Range error: result underflow
213 ÈÏ°Ï¥¨¥é¡¼: ·ë²Ì¤Î¥¢¥ó¥À¡¼¥Õ¥í¡¼
214 .\" .I errno
215 .\" is set to
216 .\" .BR ERANGE .
217 .\"O An underflow floating-point exception
218 .\"O .RB ( FE_UNDERFLOW )
219 .\"O is raised.
220 ¥¢¥ó¥À¡¼¥Õ¥í¡¼ÉâÆ°¾®¿ôÅÀÎã³°
221 .RB ( FE_UNDERFLOW )
222 ¤¬¾å¤¬¤ë¡£
223 .IP
224 .\"O These functions do not set
225 .\"O .IR errno
226 .\"O for this case.
227 ¤³¤Î¾ì¹ç¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï
228 .I errno
229 ¤òÀßÄꤷ¤Ê¤¤¡£
230 .\" FIXME . Is it intentional that these functions do not set errno?
231 .\" They do set errno for the overflow case.
232 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6795
233 .\"O .SH "CONFORMING TO"
234 .SH ½àµò
235 C99, POSIX.1-2001.
236 .\"O The variant returning
237 .\"O .I double
238 .\"O also conforms to
239 .\"O SVr4, 4.3BSD.
240 .I double
241 ÈǤδؿô¤Ï SVr4, 4.3BSD ¤Ë¤â½àµò¤·¤Æ¤¤¤ë¡£
242 .\"O .SH "SEE ALSO"
243 .SH ´ØÏ¢¹àÌÜ
244 .BR cabs (3),
245 .BR sqrt (3)