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           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE ||
21           _POSIX_C_SOURCE >= 200112L;
22           or cc -std=c99
23       hypotf(), hypotl():
24           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
25           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
26           or cc -std=c99
27

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

CONFORMING TO

67       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4,
68       4.3BSD.
69

SEE ALSO

71       cabs(3), sqrt(3)
72

COLOPHON

74       This  page  is  part of release 3.53 of the Linux man-pages project.  A
75       description of the project, and information about reporting  bugs,  can
76       be found at http://www.kernel.org/doc/man-pages/.
77
78
79
80                                  2010-09-20                          HYPOT(3)
Impressum