Comment on page
15. Complex Numbers
complextypes are used to work with complex numbers. Go has Go two types of complex numbers,
To create complex number, we use build in
Complex numbers can be declared using any of the below way
var c1 complex128 = complex(2, 3)
var c2 complex64 = complex(3, 4)
var c1 = complex(2, 3)
c1 := complex(2, 3)
When type is not specified, complex number defaults to
Since complex numbers must be created using
complex()function, these do not have a corresponding zero value.
Go provides two sizes of complex numbers,
complex128. These are used to represent complex numbers.
We need to use in-build
complexfunction to create complex type.
var x = complex(2, 2)
var x complex128 = complex(2,2)
var y complex64 = complex(3,4)
If no type is specified, it defaults to