modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/ken/cplx0.go (about)

     1  // cmpout
     2  
     3  // Copyright 2010 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Test trivial, bootstrap-level complex numbers, including printing.
     8  
     9  package main
    10  
    11  const (
    12  	R = 5
    13  	I = 6i
    14  
    15  	C1 = R + I // ADD(5,6)
    16  )
    17  
    18  func doprint(c complex128) { println(c) }
    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  }