exp()

Return the base of the natural logarithms e raised to a power

Syntax

 exp(exponent)

Parameters

ParameterDefinition

exponent

numeric value to which the natural base e is raised.

Description

The exp() function returns the value e exponent where e is the base of the natural logarithms (e = 2.71828 . . .).

Example

The following exp() function calls print a number of useful physical and mathematical constants:

function main() {
PI = 3.141593;
printf(" e = %7.4f\n",exp(1));
printf(" 1/e = %7.4f\n",exp(-1));
printf(" e^2 = %7.4f\n",exp(2));
printf(" log10(e) = %7.4f\n",log10(exp(1)));
printf(" pi^e = %7.4f\n",pow(PI,exp(1)));
printf(" e^pi = %7.4f\n",pow(exp(1),PI));
printf(" e^(-pi) = %7.4f\n",pow(exp(1),-PI));
printf(" e^(pi/2) = %7.4f\n",pow(exp(1),PI / 2));
printf("e^(-pi/2) = %7.4f\n",pow(exp(1),-PI / 2));
}
Was this page helpful? Yes No Submitting... Thank you

Comments