w3resource

C exp() function

C exp() function - Calculate exponential function

Syntax:

double exp(double x)

The exp() function is used to calculate the exponential value of a floating-point argument x ( ex , where e equals 2.17128128...).

Parameters:

Name Description Required /Optional
x The floating-point value to exponentiate the natural logarithm base e by. Required

Return value from exp()

  • Upon successful completion, these functions shall return the exponential value of x.

Example: exp() function

The following example shows the usage of exp() function.

#include <math.h>
#include <stdio.h> 
int main(void)
{
   double x, y;
 
   x = 5.0;
   y = exp(x); 
   printf("exp( %lf ) = %lf\n", x, y);
   x = 4.0;
   y = exp(x); 
   printf("\nexp( %lf ) = %lf\n", x, y);
   x = 3.0;
   y = exp(x); 
   printf("\nexp( %lf ) = %lf\n", x, y);
} 

Output:

exp( 5.000000 ) = 148.413159

exp( 4.000000 ) = 54.598150

exp( 3.000000 ) = 20.085537

C Programming Code Editor:

Previous C Programming: C tanh()
Next C Programming: C frexp()



Follow us on Facebook and Twitter for latest update.