mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
compiler: add support for complex add and sub
This is fairly trivial to add and follows the implementation of gc: https://github.com/golang/go/blob/170b8b4b12be50eeccbcdadb8523fb4fc670ca72/src/cmd/compile/internal/gc/ssa.go#L2179-L2192
This commit is contained in:
committed by
Ron Evans
parent
1113f9ec0c
commit
638bc17eeb
Vendored
+8
@@ -56,4 +56,12 @@ func main() {
|
||||
// cast complex
|
||||
println(complex64(c128))
|
||||
println(complex128(c64))
|
||||
|
||||
// binops on complex numbers
|
||||
c64 = 5+2i
|
||||
println("complex64 add: ", c64 + -3+8i)
|
||||
println("complex64 sub: ", c64 - -3+8i)
|
||||
c128 = -5+2i
|
||||
println("complex128 add:", c128 + 2+6i)
|
||||
println("complex128 sub:", c128 - 2+6i)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user