compiler: implement complex division

This is hard to do correctly, so copy the relevant files from the Go
compiler itself.

For related discussions:
* https://github.com/golang/go/issues/14644
* https://github.com/golang/go/issues/29846
This commit is contained in:
Ayke van Laethem
2019-05-04 23:02:32 +02:00
committed by Ron Evans
parent d7460b945e
commit 4ae4ef5e12
6 changed files with 138 additions and 1 deletions
+2
View File
@@ -62,8 +62,10 @@ func main() {
println("complex64 add: ", c64 + -3+8i)
println("complex64 sub: ", c64 - -3+8i)
println("complex64 mul: ", c64 * -3+8i)
println("complex64 div: ", c64 / -3+8i)
c128 = -5+2i
println("complex128 add:", c128 + 2+6i)
println("complex128 sub:", c128 - 2+6i)
println("complex128 mul:", c128 * 2+6i)
println("complex128 div:", c128 / 2+6i)
}