|
|
coherent
exp() Mathematics Function exp()
Compute exponent
#include <math.h>
ddoouubbllee eexxpp(_z) ddoouubbllee _z;
eexxpp returns the exponential of _z, or _e^_z.
***** Example *****
The following program prompts you for a number, then prints the
value for it as returned by exp, pow, log, and log10.
#include <math.h>
#include <stdio.h>
#define display(x) dodisplay((double)(x), #x)
dodisplay(value, name)
double value; char *name;
{
if (errno)
perror(name);
else
printf("%10g %s\n", value, name);
errno = 0;
}
main()
{
extern char *gets();
double x;
char string[64];
for(;;) {
printf("Enter number: ");
if(gets(string) == NULL)
break;
x = atof(string);
display(x);
display(exp(x));
display(pow(10.0,x));
display(log(exp(x)));
display(log10(pow(10.0,x)));
}
COHERENT Lexicon Page 1
exp() Mathematics Function exp()
}
***** See Also *****
errno, mathematics library
***** Diagnostics *****
eexxpp indicates overflow by an eerrrrnnoo of EERRAANNGGEE and a huge returned
value.
COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.