1HYPOT(3)                   Linux Programmer's Manual                  HYPOT(3)
2
3
4

NAME

6       hypot, hypotf, hypotl - Euclidean distance function
7

SYNOPSIS

9       #include <math.h>
10
11       double hypot(double x, double y);
12       float hypotf(float x, float y);
13       long double hypotl(long double x, long double y);
14
15       Link with -lm.
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       hypot():
20           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || _XOPEN_SOURCE
22               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24       hypotf(), hypotl():
25           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
26               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
27               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
28

DESCRIPTION

30       These  functions  return  sqrt(x*x+y*y).   This  is  the  length of the
31       hypotenuse of a right-angled triangle with sides of length x and y,  or
32       the distance of the point (x,y) from the origin.
33
34       The calculation is performed without undue overflow or underflow during
35       the intermediate steps of the calculation.
36

RETURN VALUE

38       On success, these functions return the length of a right-angled  trian‐
39       gle with sides of length x and y.
40
41       If x or y is an infinity, positive infinity is returned.
42
43       If x or y is a NaN, and the other argument is not an infinity, a NaN is
44       returned.
45
46       If the result overflows, a range error occurs, and the functions return
47       HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively.
48
49       If  both  arguments are subnormal, and the result is subnormal, a range
50       error occurs, and the correct result is returned.
51

ERRORS

53       See math_error(7) for information on how to determine whether an  error
54       has occurred when calling these functions.
55
56       The following errors can occur:
57
58       Range error: result overflow
59              errno  is  set  to ERANGE.  An overflow floating-point exception
60              (FE_OVERFLOW) is raised.
61
62       Range error: result underflow
63              An underflow floating-point exception (FE_UNDERFLOW) is raised.
64
65              These functions do not set errno for this case.
66

ATTRIBUTES

68       For  an  explanation  of  the  terms  used   in   this   section,   see
69       attributes(7).
70
71       ┌────────────────────────────┬───────────────┬─────────┐
72Interface                   Attribute     Value   
73       ├────────────────────────────┼───────────────┼─────────┤
74hypot(), hypotf(), hypotl() │ Thread safety │ MT-Safe │
75       └────────────────────────────┴───────────────┴─────────┘
76

CONFORMING TO

78       C99, POSIX.1-2001, POSIX.1-2008.
79
80       The variant returning double also conforms to SVr4, 4.3BSD.
81

SEE ALSO

83       cabs(3), sqrt(3)
84

COLOPHON

86       This  page  is  part of release 4.16 of the Linux man-pages project.  A
87       description of the project, information about reporting bugs,  and  the
88       latest     version     of     this    page,    can    be    found    at
89       https://www.kernel.org/doc/man-pages/.
90
91
92
93                                  2017-09-15                          HYPOT(3)
Impressum