@c ---------------------------------------------------------------------- @node hypot, math @subheading Syntax @example #include double hypot(double x, double y); @end example @subheading Description This function computes @code{sqrt(@var{x}*@var{x} + @var{y}*@var{y})}, the length of a hypotenuse of a right triangle whose shorter sides are @var{x} and @var{y}. In other words, it computes the Euclidean distance between the points @code{(0,0)} and @code{(@var{x},@var{y})}. Since the computation is done in extended precision, there is no danger of overflow or underflow when squaring the arguments, whereas direct computation of @code{sqrt(@var{x}*@var{x} + @var{y}*@var{y})} could cause overflow or underflow for extreme (very large or very small) values of @var{x} and @var{y}. @subheading Return Value The value of @code{sqrt(@var{x}*@var{x} + @var{y}*@var{y})}. If both arguments are finite, but the result is so large that it would overflow a @code{double}, the return value is @code{Inf}, and @code{errno} is set to @code{ERANGE}. If one of the arguments is @code{Inf}, the return value is @code{Inf} and the value of @code{errno} is left unchanged. If one of the arguments is @code{NaN}, the return value is @code{NaN} and @code{errno} is set to @code{EDOM}. @subheading Portability @portability !ansi, !posix