---
title: squareRoot()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/float16/squareroot()
---

# squareRoot()

Returns the square root of the value, rounded to a representable value.

## Declaration

```swift
func squareRoot() -> Self
```

## Return Value

Return Value The square root of the value.

## Discussion

Discussion The following example declares a function that calculates the length of the hypotenuse of a right triangle given its two perpendicular sides. func hypotenuse(_ a: Double, _ b: Double) -> Double {     return (a * a + b * b).squareRoot() }

let (dx, dy) = (3.0, 4.0) let distance = hypotenuse(dx, dy) // distance == 5.0
