Brad Fitzpatrick | e014cf0 | 2012-02-24 13:17:26 +1100 | [diff] [blame] | 1 | // cmpout |
Ken Thompson | 7d4b1e4 | 2010-03-02 18:32:11 -0800 | [diff] [blame] | 2 | |
Ken Thompson | f229c8b | 2010-03-09 12:49:24 -0800 | [diff] [blame] | 3 | // Copyright 2010 The Go Authors. All rights reserved. |
Ken Thompson | 7d4b1e4 | 2010-03-02 18:32:11 -0800 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
Rob Pike | eb37b5b | 2012-02-24 16:24:24 +1100 | [diff] [blame] | 7 | // Test trivial, bootstrap-level complex numbers, including printing. |
| 8 | |
Ken Thompson | 7d4b1e4 | 2010-03-02 18:32:11 -0800 | [diff] [blame] | 9 | package main |
| 10 | |
| 11 | const ( |
| 12 | R = 5 |
| 13 | I = 6i |
| 14 | |
| 15 | C1 = R + I // ADD(5,6) |
| 16 | ) |
| 17 | |
Russ Cox | f2b5a07 | 2011-01-19 23:09:00 -0500 | [diff] [blame] | 18 | func doprint(c complex128) { println(c) } |
Ken Thompson | 7d4b1e4 | 2010-03-02 18:32:11 -0800 | [diff] [blame] | 19 | |
| 20 | func main() { |
| 21 | |
| 22 | // constants |
| 23 | println(C1) |
| 24 | doprint(C1) |
| 25 | |
| 26 | // variables |
| 27 | c1 := C1 |
| 28 | println(c1) |
| 29 | doprint(c1) |
| 30 | } |