C <math.h> - expm1() Function
The C <math.h> expm1() function returns e raised to the power of specified number minus 1, i.e., ex-1. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.
Syntax
double expm1 (double x); float expm1f (float x); long double expm1l (long double x);
Parameters
x |
Specify the exponent of e. |
Return Value
Returns e raised to the power of specified number minus 1, i.e., ex-1.
Example:
In the example below, expm1() function is used to calculate e raised to the power of specified number minus one.
#include <stdio.h> #include <math.h> int main (){ printf("%lf\n", expm1(2)); printf("%lf\n", expm1(-2)); printf("%lf\n", expm1(1.5)); printf("%lf\n", expm1(-1.5)); return 0; }
The output of the above code will be:
6.389056 -0.864665 3.481689 -0.776870
❮ C <math.h> Library