Open In App

complx.Exp() Function in Golang With Examples

Last Updated : 28 Apr, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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: C
// Golang program to illustrate
// the complx.Exp() Function

package main

// importing fmt and math/cmplx
import (
"fmt"
"math/cmplx"
)

// Calling main method
func main() {
    
    // using the function
    fmt.Printf("%.2f", cmplx.Exp(5 + 6i))
}
Output:
(142.50-41.47i)
Example 2: C
// Golang program to illustrate
// the complx.Exp() Function

package main

// importing fmt and math/cmplx
import (
"fmt"
"math/cmplx"
)

// Calling main method
func main() {
    
    n := complex(7, 8)
    
    // using the function
    fmt.Printf("%.2f", cmplx.Exp(n))
}
Output:
(-159.56+1084.96i)

Next Article
Article Tags :

Similar Reads