Rory - 1 year ago 138

Swift Question

In Swift, what would the easiest way to find the nth root of a value be?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

We know that the Nth root of a number, x, is equivalent of raising x to a power that is the reciprocal of N. Knowing this, we can use the `pow`

function to find the Nth root:

```
let nthRoot = pow(base, (1/n))
```

where `base`

and `n`

are floating point variables.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**