Exp()
Anonymous contributor
Published Aug 7, 2023
Contribute to Docs
The Exp()
function returns the value of e^x (e to the power of x), where x is the parameter.
Syntax
import "math"
value := math.Exp(number)
Where value
is the value of e raised to the power of number
, and where number
is a variable of type float64.
Special cases:
Exp(+Inf)
returns+Inf
Exp(NaN)
returnsNaN
as well (Not a Number)
Example
The following code calculates the value of e to the power of 3, and prints the resulting value to the console.
package mainimport ("fmt""math")func main() {result := math.Exp(math.Inf(1))fmt.Printf("%.1f\n", result)}
The output will be:
+Inf
Codebyte Example
The following code is runnable and demonstrates the use of the Exp()
function.
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.