Anonymous user
Arithmetic/Complex: Difference between revisions
→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details
m (→{{header|Nim}}) |
(→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details) |
||
Line 2,384:
=={{header|Kotlin}}==
<lang scala>class Complex(private val real: Double, private val imag: Double) {▼
operator fun plus(other: Complex)
▲class Complex(val real: Double, val imag: Double) {
▲ operator fun times(other: Complex): Complex {
▲ return Complex(this.real * other.real - this.imag * other.imag,
fun inv(): Complex {
val denom
return Complex(
}
operator fun unaryMinus()
operator fun minus(other: Complex)
operator fun div(other: Complex)
fun conj()
override fun toString()
if (
}
fun main(args: Array<String>) {
val x = Complex(1.0, 3.0)
|