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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE ||
20       _ISOC99_SOURCE; or cc -std=c99
21       hypotf(), hypotl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
22       || _ISOC99_SOURCE; or cc -std=c99
23

DESCRIPTION

25       The  hypot() function returns sqrt(x*x+y*y).  This is the length of the
26       hypotenuse of a right-angled triangle with sides of length x and y,  or
27       the distance of the point (x,y) from the origin.
28
29       The calculation is performed without undue overflow or underflow during
30       the intermediate steps of the calculation.
31

RETURN VALUE

33       On success, these functions return the length of a right-angled  trianā€
34       gle with sides of length x and y.
35
36       If x or y is an infinity, positive infinity is returned.
37
38       If x or y is a NaN, and the other argument is not an infinity, a NaN is
39       returned.
40
41       If the result overflows, a range error occurs, and the functions return
42       HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively.
43
44       If  both  arguments are subnormal, and the result is subnormal, a range
45       error occurs, and the correct result is returned.
46

ERRORS

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

CONFORMING TO

63       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4,
64       4.3BSD.
65

SEE ALSO

67       cabs(3), sqrt(3)
68

COLOPHON

70       This  page  is  part of release 3.22 of the Linux man-pages project.  A
71       description of the project, and information about reporting  bugs,  can
72       be found at http://www.kernel.org/doc/man-pages/.
73
74
75
76                                  2008-08-05                          HYPOT(3)
Impressum