I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingCMath.h

expm1f

Exponential functions
+ View other versions (4)

Interface

#include <math.h>
double exp (double x)
long expl (long double x)
float expf (float x)
double exp2 (double x)
long exp2l (long double x)
float exp2f (float x)
double expm1 (double x)
long expm1l (long double x)
float expm1f (float x)

Description

The exp function computes e^x, the base-e exponential of x.

The exp2 function computes 2^x, the base-2 exponential of x.

The expm1 function computes the base-e exponential of x, minus 1, accurately even for very small values of x.

Example:
Example - Exponential functions
Workings
#include <stdio.h>
#include <math.h>
int main(void)
{
  double result, x = 4.34;
  result = exp(x);
  printf("'e' raised to the power of %.2lf (e^%.2lf) = %.2lf\n", x, x, result);
  return 0;
}
Solution
Output:
'e' raised to the power of 4.34 (e^4.34) = 76.71

Special Values

exp ( ±0 ) and exp2 ( ±0 ) return 1.

exp ( -∞ ) and exp2 ( -∞ ) return +0.

exp ( +∞ ) and exp2 ( +∞ ) return +∞.

expm1 ( ±0 ) returns ±0.

expm1 ( -∞ ) returns -1.

expm1 ( +∞ ) returns +∞.

For all these functions, a range error occurs if the magnitude of x is too large.

Standards

The exp, exp2 and expm1 functions conform to ISO/IEC 9899:1999(E).