Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C |
both |
#include <math.h>
double exp(double x);
float exp(float x); /* C++ only */
long double exp(long double x); /* C++ only */
float expf(float x);
long double expl(long double x);
If successful, the function returns the calculated value.
If an overflow occurs, the function returns HUGE_VAL. If an underflow occurs, it returns 0. Both overflow and underflow set errno to ERANGE.
⁄* CELEBE06
This example calculates y as the exponential function of x.
*⁄
#include <math.h>
#include <stdio.h>
int main(void)
{
double x, y;
x = 5.0;
y = exp(x);
printf("exp( %f ) = %f\n", x, y);
}
exp( 5.000000 ) = 148.413159