Finding the Base-e Exponential of Given Number in Golang
Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You are allowed to find base-e exponential, i.e., e**a of the specified number with the help of Exp() function provided by the math package. So, you need to add a math package in your program with the help of the import keyword to access the Exp() function.
func Exp(a float64) float64
- If you pass +Inf in this function, then this function will return +Inf.
- In this function, very large values overflow to 0 or +Inf and very small values underflow to 1.
- If you pass NaN in this function, then this function will return NaN.
Result 1: 20.1 Result 2: 2.7 Result 3: +Inf Result 4: NaN
7.4 + 20.1 = 27.5