Go 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+InfExp(NaN)returnsNaNas 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.
Learn Go on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn how to use Go (Golang), an open-source programming language supported by Google!
- Beginner Friendly.6 hours