Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pow (**) operator in Swift
import Darwin
infix operator ** {
associativity left
precedence 160
}
func ** (base: Double, power: Double) -> Double {
return pow(base, power)
}
func ** (base: Float, power: Float) -> Float {
return powf(base, power)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.