English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C ++in expm1() function calculates e^x - 1value. For smaller values of x, e^x - 1 than exp(x) - 1more precise.
This function is<cmath>defined in the header file.
ex - 1 = expm1(x)
double expm1(double x); float expm1(float x); long double expm1(long double x); double expm1(T x); //Here, T is an integer type.
expm1() function takes a single mandatory parameter (can be positive, negative, or 0).
expm1() function returns[-1, ∞]Value within the range.
If the size of the result is too large to be represented by the return type value, the function will return HUGE_VAL with the correct sign, and an overflow range error will occur.
#include <iostream> #include <cmath> using namespace std; int main() { double x = 2.19, result; result = expm1 cout << "e^" << x << "(x);" - 1 =" << result << endl; return 0; }
The output when running the program is:
e^2.19 - 1 = 7.93521
#include <iostream> #include <cmath> using namespace std; int main() { int x = 4; double result; result = expm1 cout << "e^" << x << "(x);" - 1 =" << result << endl; return 0; }
The output when running the program is:
e^4 - 1 = 53.5982