1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
31 .TH HYPOT 3 2008-08-05 "" "Linux Programmer's Manual"
33 hypot, hypotf, hypotl \- Euclidean distance function
38 .BI "double hypot(double " x ", double " y );
40 .BI "float hypotf(float " x ", float " y );
42 .BI "long double hypotl(long double " x ", long double " y );
48 Feature Test Macro Requirements for glibc (see
49 .BR feature_test_macros (7)):
54 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE; or
59 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
66 .RI sqrt( x * x + y * y ).
67 This is the length of the hypotenuse of a right-angled triangle
72 or the distance of the point
76 The calculation is performed without undue overflow or underflow
77 during the intermediate steps of the calculation.
78 .\" e.g., hypot(DBL_MIN, DBL_MIN) does the right thing, as does, say
79 .\" hypot(DBL_MAX/2.0, DBL_MAX/2.0).
81 On success, these functions return the length of a right-angled triangle
92 positive infinity is returned.
99 and the other argument is not an infinity,
102 If the result overflows,
103 a range error occurs,
104 and the functions return
111 If both arguments are subnormal, and the result is subnormal,
112 .\" Actually, could the result not be subnormal if both arguments
113 .\" are subnormal? I think not -- mtk, Jul 2008
114 a range error occurs,
115 and the correct result is returned.
119 for information on how to determine whether an error has occurred
120 when calling these functions.
122 The following errors can occur:
124 Range error: result overflow
128 An overflow floating-point exception
132 Range error: result underflow
136 An underflow floating-point exception
140 These functions do not set
143 .\" FIXME . Is it intentional that these functions do not set errno?
144 .\" They do set errno for the overflow case.
145 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6795
148 The variant returning