complx.Exp() Function in Golang With Examples
Last Updated :
28 Apr, 2020
complx.Exp() Function in Golang is used to returns e**x, the base-e exponential of x.
Syntax:
func Exp(x complex128) complex128
Here, x is the set of all complex numbers real as well as imaginary parts.
Return Type: The return type of this function is a complex number.
Example 1:
package main
import (
"fmt"
"math/cmplx"
)
func main() {
fmt.Printf( "%.2f" , cmplx.Exp(5 + 6i))
}
|
Output:
(142.50-41.47i)
Example 2:
package main
import (
"fmt"
"math/cmplx"
)
func main() {
n := complex(7, 8)
fmt.Printf( "%.2f" , cmplx.Exp(n))
}
|
Output:
(-159.56+1084.96i)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...