1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" 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)
29 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2002-07-27 by Walter Harms
31 .\" (walter.harms@informatik.uni-oldenburg.de)
33 .TH HYPOT 3 2021-03-22 "" "Linux Programmer's Manual"
35 hypot, hypotf, hypotl \- Euclidean distance function
40 .BI "double hypot(double " x ", double " y );
41 .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 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
56 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
57 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
63 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
64 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
65 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
68 These functions return
69 .RI sqrt( x * x + y * y ).
70 This is the length of the hypotenuse of a right-angled triangle
75 or the distance of the point
79 The calculation is performed without undue overflow or underflow
80 during the intermediate steps of the calculation.
81 .\" e.g., hypot(DBL_MIN, DBL_MIN) does the right thing, as does, say
82 .\" hypot(DBL_MAX/2.0, DBL_MAX/2.0).
84 On success, these functions return the length of the hypotenuse of
85 a right-angled triangle
96 positive infinity is returned.
103 and the other argument is not an infinity,
106 If the result overflows,
107 a range error occurs,
108 and the functions return
115 If both arguments are subnormal, and the result is subnormal,
116 .\" Actually, could the result not be subnormal if both arguments
117 .\" are subnormal? I think not -- mtk, Jul 2008
118 a range error occurs,
119 and the correct result is returned.
123 for information on how to determine whether an error has occurred
124 when calling these functions.
126 The following errors can occur:
128 Range error: result overflow
132 An overflow floating-point exception
136 Range error: result underflow
137 An underflow floating-point exception
141 These functions do not set
144 .\" This is intentional; see
145 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6795
147 For an explanation of the terms used in this section, see
155 Interface Attribute Value
160 T} Thread safety MT-Safe
166 C99, POSIX.1-2001, POSIX.1-2008.
168 The variant returning