EXP: Raising e to the Nth Power

How to: |

Available Languages: reporting, Maintain

The EXP function raises the value "e" (approximately 2.72) to a specified power. This function is the inverse of the LOG function, which returns the logarithm of the argument.

EXP calculates the result by adding terms of an infinite series. If a term adds less than .000001 percent to the sum, the function ends the calculation and returns the result as a double-precision number.

Syntax: How to Raise e to the Nth Power

EXP(power, output)

where:

- power
Numeric

Is the power to which "e" is raised.

- output
Double-precision floating-point

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Example: Raising e to the Nth Power

EXP raises "e" to the power designated by the &POW variable, specified here as 3. The result is then rounded to the nearest integer with the .5 rounding constant and returned to the variable &RESULT. The format of the output value is D15.3.

```
-SET &POW = '3';
-SET &RESULT = EXP(&POW, 'D15.3') + 0.5;-HTMLFORM BEGIN
<HTML>
<BODY>
E TO THE &POW POWER IS APPROXIMATELY &RESULT
</BODY>
</HTML>
-HTMLFORM END
```

The output is:

E TO THE 3 POWER IS APPROXIMATELY 20

WebFOCUS |