Golang builtin.complex() function example

package builtin

The complex built-in function constructs a complex value from two floating-point values. The real and imaginary parts must be of the same size, either float32 or float64 (or assignable to them), and the return value will be the corresponding complex type (complex64 for float32, complex128 for float64).

Golang builtin.complex() function usage example

 package main

 import "fmt"

 func main() {
 fmt.Println(complex(100, 8))
 }

Output :

(100+8i)

Reference :

http://golang.org/pkg/builtin/#complex

Advertisement