# Overhaul of Exponents in Swift

I use Foundation's `pow(_:_:)`

function often when performing calculations. This function for me has one major draw back, it does not have an overload for `Int`

. Better yet, the introduction of an exponent operator would help simplify this arithmetic operation's use even more so.

**I often find myself writing:**

```
var x: Int = 5
var y: Int = 2
var n = Int(pow(Double(x), Double(y)))
```

Since the majority of the time I find my self using `pow(_:_:)`

with just `Int`

, this gets quite annoying to write.

It feels quite unnecessary to perform all of these type conversions and would be made much easier with the introduction of overloads to the `pow(_:_:)`

function that support `Int`

.

### Possible overloads:

```
func pow(_ x: Int, _ y: Int) -> Int { ... }
```

```
func pow(_ x: Int, _ y: Double) -> Double { ... }
```

```
func pow(_ x: Double, _ y: Int) -> Double { ... }
```

### Exponent Operator

Exponents in Swift are frankly annoying to work with as is no matter how you slice. The addition of an exponent operator like `**`

as a protocol extension on `Numeric`

would make its use much easier all around the board.

What are your thoughts on the addition of these overloads?

Also, what are your thoughts on the addition of an exponent operator `**`

as a protocol extension for on `Numeric`

?