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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Why do we need reference variables if we have pointers
- Similarities and Difference between Java and C++
- Macros and its types in C/C++
- How to find index of a given element in a Vector in C++
- Introduction to Complex Objects and Composition
- NULL undeclared error in C/C++ and how to resolve it
- std::remove_const in C++ with Examples
- Finding Median of unsorted Array in linear time using C++ STL
- Average of Cubes of first N natural numbers
- Top 10 Programming Languages for Blockchain Development
- Memory Allocation in Static Data Members in C++
- Exception header in C++ with examples
- Mutual friendship of Classes in C++ with Examples
- Slicing a Vector in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.