exp()
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
- garanews222 total contributions
- borntofrappe3 total contributions
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- StevenSwiniarski475 total contributions
- Christine_Yang271 total contributions
- garanews
- borntofrappe
- christian.dinh
- Anonymous contributor
- StevenSwiniarski
- Christine_Yang
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.