Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
10
Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift
Normal file
10
Task/Arithmetic-Complex/Swift/arithmetic-complex-3.swift
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
public func - (left:Complex, right:Complex) -> Complex {
|
||||
return left + -right
|
||||
}
|
||||
|
||||
public func / (divident:Complex, divisor:Complex) -> Complex {
|
||||
let rc = divisor.conjugate
|
||||
let num = divident * rc
|
||||
let den = divisor * rc
|
||||
return Complex(real: num.real/den.real, imaginary: num.imaginary/den.real)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue