complx.Pow() Function in Golang is used to find x**y, the base-x exponential of y. For this function, one need to import the “math/cmplx” package.
Syntax:
func Pow(x, y complex128) complex128
- Pow(0, ±0) returns 1+0i
- Pow(0, c) for real(c)<0 returns Inf+0i if imag(c) is zero, otherwise Inf+Inf i
Parameters: The parameters used are two complex numbers where complex128 is the set of all complex numbers with float64 real and imaginary parts. The return type of this function is also a complex number.
Example 1:
package main import ( "fmt" "math/cmplx") func main() { var a complex128 var b complex128 a= complex(2,5) b= complex(3,7) fmt.Println(cmplx.Pow(a,b)) } |
Output:
(-0.03528847161704272+0.0129436389603905i)
Example 2:
// Golang program to illustrate // the complx.Pow() Function package main import ( "fmt" "math/cmplx") func main() { var a complex128 var b complex128 a= complex(1,2) b= complex(1,0) // using the function fmt.Println(cmplx.Pow(a,b)) } |
Output:
(1.0000000000000002+2i)
Recommended Posts:
- math.Lgamma() Function in Golang with Examples
- math.Float64bits() Function in Golang With Examples
- atomic.AddInt64() Function in Golang With Examples
- atomic.StoreInt64() Function in Golang With Examples
- reflect.FieldByIndex() Function in Golang with Examples
- string.Contains Function in Golang with Examples
- bits.Sub() Function in Golang with Examples
- io.PipeWriter.CloseWithError() Function in Golang with Examples
- time.Round() Function in Golang With Examples
- reflect.AppendSlice() Function in Golang with Examples
- reflect.ChanOf() Function in Golang with Examples
- flag.Bool() Function in Golang With Examples
- time.Sleep() Function in Golang With Examples
- time.Time.Year() Function in Golang with Examples
- reflect.DeepEqual() Function in Golang with Examples
- reflect.Indirect() Function in Golang with Examples
- reflect.CanAddr() Function in Golang with Examples
- reflect.CanInterface() Function in Golang with Examples
- reflect.CanSet() Function in Golang with Examples
- reflect.Cap() Function in Golang with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

