Computes the square root of the sum of squares.
HYPOT(x, y)
x |
- |
A scalar, series or table. |
y |
- |
A scalar, series or table. |
A scalar or series, the right triangle hypotenuse formula
hypot(3, 4)
returns 5, the hypotenuse of a 3-4-5 triangle.
a = 1e200;
b = sqrt(a*a + a*a);
c = hypot(a, a);
b == inf
c == 1.414214e+200
Variable a contains a large real value. The straightforward computation overflows, but HYPOT returns the correct value without overflow.
a = 1e-200;
b = sqrt(a*a + a*a);
c = hypot(a, a);
b == 0.0
c == 1.414214e-200
Variable a contains a small real value. The straightforward computation underflows, but HYPOT returns the correct value without underflow.
W1: 1..5
W2: {3, 1, inf, 3, 5}
W3: hypot(w1, w2)
W3 == {3.162278, 2.236068, inf, 5.000000, 7.071068}
HYPOT(x, y) computes the right triangle hypotenuse formula:
with underflow and overflow protection using a routine compatible with the IEEE 754 hypot function.
For complex x or y, HYPOT effectively computes: