hypot

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y.

@IEEECompliant("hypot", 42)
hypot
(
D1
D2
)
(
auto const ref D1 x
,
auto const ref D2 y
)
if ()

Throws

InvalidOperationExceptionx, y is signaling NaN
OverflowExceptionresult is too big to be represented
InexactExceptionthe result is inexact

Special values

xyhypot(x, y)
±∞any+∞
any±∞+∞
NaNNaNnan
NaNanynan
anyNaNnan
0.0anyy
any0.0x

Examples

decimal32 x = 3;
decimal32 y = 4;
assert (hypot(x, y) == 5);

Meta