Predeclared type

Go complex128 type

Complex type with float64 real and imaginary components. Default type of an untyped complex constant when a default is needed. Equality is allowed, ordering is not. Example output: '(-3+4i)'.

Formal Syntax & Structure

go syntaxgo
complex128

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  var z complex128 = 1 + 2i  fmt.Println(z * z)}
Go Reference