exp()
Published Jul 20, 2021Updated Dec 21, 2022
Contribute to Docs
The exp()
function returns the base-e
exponential value of the argument (i.e., e
raised to the power of the argument). This is the inverse of the log()
function.
Syntax
exp(x)
The x
parameter is a double
value that can be positive, negative, or zero.
Example
The following example uses the exp()
function to find the value of e3:
#include <iostream>#include <cmath>int main() {double x = 3;double result;result = exp(x);std::cout << "The exp of " << x << " is " << result << "\n";}
This produces the following output:
The exp of 3 is 20.0855
Codebyte Example
The following example is runnable and returns the value of e1:
All contributors
Looking to contribute?
- 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.