The expm1(x) function returns ex – 1 where x is an argument and e is mathematical constant with value equal to 2.71828.
double expm1() (double x); float expm1() (float x); long double expm1() (long double x);
- The expm1() function takes a single argument and computes e^x -1.
- The expm1() function returns e^x -1 if we pass x in the argument.
- It is mandatory to give both the arguments otherwise it will give error no matching function for call to ‘expm1()’.
- If we pass string as argument we will get error no matching function for call to ‘expm1(const char [n]).
- If we pass std::numeric_limits::max() we will get -2147483648.
Error and Exception:
Input : expm1(5.35) Output : 209.608
Input : expm1(-5) Output : -0.993262
# CODE 1
e^5.35 - 1 = 209.608
# CODE 2
e^-5 - 1 = -0.993262
- Difference between Private and Protected in C++ with Example
- Difference between Inheritance and Polymorphism
- Difference between Single and Multiple Inheritance in C++
- Difference between Abstraction and Encapsulation in C++
- return statement in C/C++ with Examples
- How to implement our own Vector Class in C++?
- Web Programming in C++
- C++ Program to print an Array using Recursion
- Storage Classes in C++ with Examples
- fill_n() function in C++ STL with examples
- fill() function in C++ STL with examples
- How to erase an element from a vector using erase() and reverse_iterator?
- iomanip setbase() function in C++ with Examples
- iomanip setpricision() function in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.