---
title: "hypot(_:_:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/hypot(_:_:)-7ku7m"
---

# hypot(_:_:)

Returns the double-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of the two input vectors.

## Declaration

```swift
static func hypot<U, V>(_ x: U, _ y: V) -> [Double] where U : AccelerateBuffer, V : AccelerateBuffer, U.Element == Double, V.Element == Double
```

## Parameters

- `x`: An array that contains the lengths of the first set of legs of the triangles.
- `y`: An array that contains the lengths of the second set of legs of the triangles.

## Discussion

Discussion This function returns the square roots of the sum of the squares of corresponding elements of vectors x and y, using the following operation: for (n = 0; n < N; ++n)     C[n] = sqrt(x[n]*x[n] + y[n]*y[n]); For example, the following code calculates the hypotenuse of four Pythagorean triples:     let x: [Float] = [3, 6, 5, 9]     let y: [Float] = [4, 8, 12, 12]          let hypotenuses = vDSP.hypot(x, y)          // Prints "[5.0, 10.0, 13.0, 15.0]".     print(hypotenuses)

## See Also

### Related Documentation

- [vDSP_vdist](accelerate/vdsp_vdist.md)

### Type Methods

- [absolute(_:)](accelerate/vdsp/absolute(_:)-9c3ge.md)
- [absolute(_:)](accelerate/vdsp/absolute(_:)-5ehc1.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-9x5jn.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-1wu9x.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-657bd.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-4pigo.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-9mv1a.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-2ftxc.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-53nh9.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-7swvf.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2531u.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2w0o9.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-338hl.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-3vzwi.md)
- [add(_:to:count:result:)](accelerate/vdsp/add(_:to:count:result:)-g1dk.md)
