HYPOT(3M) BSD HYPOT(3M)
NAME
hypot, cabs - Euclidean distance, complex absolute value
SYNOPSIS
#include <math.h>
double hypot(x,y)
double x,y;
double cabs(z)
struct {double x,y;} z;
DESCRIPTION
hypot(x,y) and cabs(x,y) return sqrt(x*x+y*y) computed in such a way that
underflow will not happen, and overflow occurs only if the final result
deserves it.
hypot(infinity,v) = hypot(v,infinity) = +infinity for all v, including
NaN. math(3M), matherr(3M), sqrt(3M)
NOTES
As might be expected, hypot(v,NaN) and hypot(NaN,v) are NaN for all
finite v; with "reserved operand" in place of "NaN". You might be
surprised at first to discover that hypot(+infinity,NaN) = +infinity.
This is intentional; it happens because hypot(infinity,v) = +infinity for
all v, finite or infinite. Hence hypot(infinity,v) is independent of v.
The IEEE NaN is designed to disappear when it turns out to be irrelevant,
as it does in hypot(infinity,NaN).