| 1 |
# exp(x): Exponential |
| 2 |
|
| 3 |
Exponential function. |
| 4 |
|
| 5 |
## Declaration |
| 6 |
|
| 7 |
### Syntax |
| 8 |
|
| 9 |
```fortran |
| 10 |
retval = exp(x) |
| 11 |
elemental real function exp(x) |
| 12 |
``` |
| 13 |
|
| 14 |
### Arguments |
| 15 |
|
| 16 |
`x` the input value must be of type real or complex. |
| 17 |
|
| 18 |
### Return values |
| 19 |
|
| 20 |
The return value is of same type as of the input argument, `x`. |
| 21 |
|
| 22 |
## Description |
| 23 |
|
| 24 |
**exp(x)** computes the base $e$ exponential of `x`, i.e., $e^x$. |
| 25 |
|
| 26 |
If `x` is of type complex, its imaginary part is considered as a value in |
| 27 |
radians. |
| 28 |
|
| 29 |
## Types |
| 30 |
|
| 31 |
Supported argument types is real and complex. |
| 32 |
|
| 33 |
```fortran |
| 34 |
interface exp |
| 35 |
module procedure sexp, dexp, cexp, zexp |
| 36 |
end interface |
| 37 |
|
| 38 |
contains |
| 39 |
|
| 40 |
elemental real(sp) function sexp(x) |
| 41 |
real(sp), intent(in) :: x |
| 42 |
end function |
| 43 |
|
| 44 |
elemental real(dp) function dexp(x) |
| 45 |
real(dp), intent(in) :: x |
| 46 |
end function |
| 47 |
|
| 48 |
elemental complex(sp) function cexp(x) |
| 49 |
complex(sp), intent(in) :: x |
| 50 |
end function |
| 51 |
|
| 52 |
elemental complex(dp) function zexp(x) |
| 53 |
complex(dp), intent(in) :: x |
| 54 |
end function |
| 55 |
``` |
| 56 |
|
| 57 |
## Examples |
| 58 |
|
| 59 |
```fortran |
| 60 |
program intrinsics_exp |
| 61 |
print *, exp(0.5) |
| 62 |
end program |
| 63 |
``` |
| 64 |
|
| 65 |
**Result:** |
| 66 |
|
| 67 |
``` |
| 68 |
1.64872 |
| 69 |
``` |
| 70 |
|
| 71 |
## See Also |