The exp() function in C++ returns the exponential (Euler’s number) e (or 2.71828) raised to the given argument.
Syntax for returning exponential e:
The function can take any value i.e, positive, negative or zero in its parameter and returns result in int, double or float or long double.
The exp() function returns the value in the range of [0, inf].
It shows error when we pass more then one argument in exp function
Given below is an example of application of exp() function
exp(x) = 22026.5
Applications of e (mathematical constant):
- Compound Interest : An account that starts at $1 and offers an annual interest rate of R will, after t years, yield eRt dollars with continuous compounding (Here R is the decimal equivalent of the rate of interest expressed as a percentage, so for 5% interest, R = 5/100 = 0.05)
- Value of below expression is e.
- The probability that a gambler never wins if he/she tries million times in a game where chances of winning in every trial is one by million is close to 1/e.
- The number e is the sum of the infinite series
Source : Wiki
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Difference between virtual function and inline function in C++
- Function Overloading vs Function Overriding in C++
- How to call function within function in C or C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- div() function in C++
- fma() function in C++
- log() function in C++
- isfinite() function in C++
- nearbyint() function in C++
- clock() function in C/C++
- fegetenv() function in C/C++
- fegetexceptflag() function in C/C++
- wctrans() function in C/C++
- wmemcpy() function in C/C++
- wcstok() function in C++ with example
- wcsstr() function in C++ with example
- wcsncpy() function in C++ with example
- imag() function in C++
- real() function 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 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.
Improved By : solankinilesh61