diff options
author | Ayke van Laethem <[email protected]> | 2020-10-28 00:49:13 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-10-28 07:38:51 +0100 |
commit | 3e40b08ba005643bd0190fe45437a82404519c16 (patch) | |
tree | 20e65b17dcde5bd4b15f01df435a1639ffc5ed77 /testdata | |
parent | ffeff5570692c019c734e3ca28db85bc48430f7f (diff) | |
download | tinygo-3e40b08ba005643bd0190fe45437a82404519c16.tar.gz tinygo-3e40b08ba005643bd0190fe45437a82404519c16.zip |
compiler: implement negate for complex numbers
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/float.go | 4 | ||||
-rw-r--r-- | testdata/float.txt | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/testdata/float.go b/testdata/float.go index f2b7c52e3..8c33cf11b 100644 --- a/testdata/float.go +++ b/testdata/float.go @@ -57,15 +57,17 @@ func main() { println(complex64(c128)) println(complex128(c64)) - // binops on complex numbers + // binops and negate on complex numbers c64 = 5 + 2i println("complex64 add: ", c64+-3+8i) println("complex64 sub: ", c64 - -3 + 8i) println("complex64 mul: ", c64*-3+8i) println("complex64 div: ", c64/-3+8i) + println("complex64 neg: ", -c64) 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) + println("complex128 neg:", -c128) } diff --git a/testdata/float.txt b/testdata/float.txt index 4b7e3357f..dbc36fb8a 100644 --- a/testdata/float.txt +++ b/testdata/float.txt @@ -27,7 +27,9 @@ complex64 add: (+2.000000e+000+1.000000e+001i) complex64 sub: (+8.000000e+000+1.000000e+001i) complex64 mul: (-1.500000e+001+2.000000e+000i) complex64 div: (-1.666667e+000+7.333333e+000i) +complex64 neg: (-5.000000e+000-2.000000e+000i) complex128 add: (-3.000000e+000+8.000000e+000i) complex128 sub: (-7.000000e+000+8.000000e+000i) complex128 mul: (-1.000000e+001+1.000000e+001i) complex128 div: (-2.500000e+000+7.000000e+000i) +complex128 neg: (+5.000000e+000-2.000000e+000i) |