Hypot

The function \(\textrm{Hypot}\) returns the hypotenuse of a right triangle. Suppose that the two sides of the triangle are \(x\) and \(y\), without loss of generality assume \(x\geq y>0\). The function avoids the issues of the native implementation \(\sqrt{x^2+y^2}\) which can cause overflow or underflow errors. The result of \(\sqrt{x^2+y^2}\) is computed as

\[ \textrm{Hypot}(x,y)= \kappa\sqrt{(x/\kappa)^2 +(y/\kappa)^2},\qquad \kappa = \max\{\abs{x},\abs{y}\} \]