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
- garanews
- borntofrappe
- christian.dinh
- Anonymous contributor
- StevenSwiniarski
- Christine_Yang
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 C++ on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn C++
Learn C++ — a versatile programming language that’s important for developing software, games, databases, and more.Beginner Friendly11 hours