totn C Functions

C Language: exp function
(Exponential)

In the C Programming Language, the exp function returns e raised to the power of x.

Syntax

The syntax for the exp function in the C Language is:

double exp(double x);

Parameters or Arguments

x
The value used in the calculation where e is raised to the power of x. If the magnitude of x is too large, the exp function will return a range error.

Returns

The exp function returns the result of e raised to the power of x.

Required Header

In the C Language, the required header for the exp function is:

#include <math.h>

Applies To

In the C Language, the exp function can be used in the following versions:

  • ANSI/ISO 9899-1990

exp Example

/* Example using exp by TechOnTheNet.com */

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{
    /* Define temporary variables */
    double value;
    double result;

    /* Assign the value we will find the exp of */
    value = 5;

    /* Calculate the exponential of the value */
    result = exp(value);

    /* Display the result of the calculation */
    printf("The Exponential of %f is %f\n", value, result);

    return 0;
}

When compiled and run, this application will output:

The Exponential of 2.100000 is 8.166170

Similar Functions

Other C functions that are similar to the exp function: