The function expm1() is used to calculate the exponential raised to the power of any number minus one. It returns the value of (exponential raised to the power of a) - 1.
Here is the mathematical expression of expm1(),
expm1(a) = (e^a) - 1
Here is the syntax of expm1() in C++ language,
float expm1(variable_name);
Here,
variable_name − Any name given to the variable whose value is calculated.
Here is an example of expm1() in C++ language,
Example
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int x = 10;
float y = 8.28;
cout << "The value of x : " << expm1(x);
cout << "\nThe value of y : " << expm1(y);
return 0;
}Output
Here is the output
The value of x : 22025.5 The value of y : 3943.19