Join our newsletter for the latest updates.

C exp()

The exp() function computes the exponential (Euler's number) raised to the given argument.

C exp() Prototype

double exp( double arg );

The exp(arg) takes a single argument and returns the value in type double.

[Mathematics] ex = exp(x) [In C programming]

It is defined in <math.h> header file.

In order to calculate the exp() for long double or float, you can use the following prototype

long double expl( long double arg);
float expf( float arg);

C exp() range

The arguments for exp() can be any value, either negative or positive.

Example: C exp() function

#include <stdio.h>
#include <math.h>
int main()
  double x = 12.0, result;
  result = exp(x);
  printf("Exponential of %.2lf = %.2lf", x, result);
  return 0;


Enter the value of x to find e^x: 12
Exponential of 12.00 = 162754.79