mirror of
https://github.com/twostraws/Brisk.git
synced 2024-08-16 22:10:37 +03:00
Merge pull request #2 from multitudes/multitudes-patch--operator
Update Numeric.swift
This commit is contained in:
commit
5708634d06
@ -39,3 +39,25 @@ func /<I: BinaryInteger, F: BinaryFloatingPoint>(lhs: I, rhs: F) -> F {
|
||||
func /<I: BinaryInteger, F: BinaryFloatingPoint>(lhs: F, rhs: I) -> F {
|
||||
return lhs / F(rhs)
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// How to replicate the ** operator in Swift
|
||||
//
|
||||
|
||||
infix operator **
|
||||
|
||||
func **<I: BinaryInteger>(lhs: I, rhs: I) -> I {
|
||||
return I(pow(Double(lhs), Double(rhs)))
|
||||
}
|
||||
|
||||
func **<I: BinaryInteger, F: BinaryFloatingPoint>(lhs: I, rhs: F) -> F {
|
||||
return F(pow(Double(lhs),Double(rhs)))
|
||||
}
|
||||
|
||||
func **<I: BinaryInteger, F: BinaryFloatingPoint>(lhs: F, rhs: I) -> F {
|
||||
return F(pow(Double(lhs),Double(rhs)))
|
||||
}
|
||||
|
||||
func **<F: BinaryFloatingPoint>(lhs: F, rhs: F) -> F {
|
||||
return F(pow(Double(lhs),Double(rhs)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user