The exp()
function in C++ is simply used to return the exponential (e) or the Euler’s number raised to the argument given in the function.
Euler’s number = 2.71828
The fmax()
function is defined in the <cmath>
header file.
result = exp(x)
The exp()
function takes any value x
(negative, zero or positive) as its parameter value.
The exp()
function returns the exponential value of a given number in int
, double
, float
, or long double
between zero and infinity.
#include <bits/stdc++.h>using namespace std;// function to explain use of exp() functiondouble Exponentiation(double x){double result = exp(x);cout << "exp(x) = " << result << endl;return result;}// driver programint main(){double x = 10;Exponentiation(x);return 0;}
Exponentiation()
and passed x
as its parameter value.exp()
function to the variable result
.result
variable.result
variable.10
to x
.Exponentiation()
function to take the exponential of the value 10
that we assigned to x
.