.TH exp() "" "" "Mathematics Function (libm)"
.PC "Compute exponent"
.B "#include <math.h>"
\fBdouble exp(\fIz\^\fB) double \fIz\^\fB;\fR
.PP
\fBexp()\fR returns the exponential of \fIz\fR, or \fIe^z\fR.
.SH Example
The following example, called
.BR apr.c ,
computes the annual percentage rate (APR)
for a given rate of interest.
Compile it with the command:
.DM
	cc -f apr.c -lm
.DE
.PP
It is by Brent Seidel (brent_seidel@chthone.stat.com):
.DM
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
.DE
.DM
main()
{
	double rate, APR;
	char buffer[50];
.DE
.DM
	printf("Enter interest rate in percent (e.g., 12.9): ");
	fflush(stdout);
.DE
.DM	
	if (gets(buffer) == NULL)
		exit(EXIT_FAILURE);
	rate = strtod(buffer);
.DE
.DM
	APR = (exp(rate/100.0) - 1) * 100.0;
	printf("The APR for %g%% compounded daily is %g%%\en", rate, APR);
}
.DE
.SH "See Also"
.Xr "errno," errno
.Xr "frexp()," frexp
.Xr "ldexp()," ldexp
.Xr "libm" libm
.br
\*(AS, \(sc7.5.4.1
.br
\*(PX Standard, \(sc8.1
.SH Diagnostics
.B exp()
indicates overflow by an
.B errno
of
.B ERANGE
and a huge returned value.
