exp, expl
Calculates the exponential e to the x.
Defined in header <math.h>
Syntax
Real versions: Complex version:
#include <math.h> #include <complex.h>
double exp(double x); complex exp(complex x);
long double expKlong double x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| expl | ■ | ■ | |||
| Real exp | ■ | ■ | ■ | ■ | |
| Complex exp | ■ | ■ | ■ |
Remarks
exp calculates the exponential function e^.
expl is the long double version; it takes a long double argument and returns a long double result.
The complex exponential function is defined by
exp(x + y 0 = exp(x) (cos(i/) + i sin(i/))
Return value
exp returns e^.
Sometimes the arguments passed to these functions produce results that overflow or are incalculable. When the correct value overflows, exp
| returns the value HUGE_VAL | and expl returns _LHUGE_VAL. | Results of |
excessively large magnitude will cause the global variable errno to be set to
ERANGE Result out of range On underflow, these functions return 0.0, and the global variable errno is
not changed.
Error handling for these functions can be modified through the functions matherr and _matherrl.
See also
Example
#include <stdio.h>
#include <math.h>
int main(void)
double result, x = 4.0;
result - exp(x);
printfC'e' raised to the power of %lf (e *If) %lf\n", X, X, result) ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/math.h/exp/
· short form /3.1/exp/