Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

# Exp

Returns e (the base of natural logarithms) raised to a power.

## Synopsis

```Exp(number)
```

### Arguments

The number argument can be any valid numeric expression. On a Windows system, if the value of number is greater than 335, a runtime error occurs; if the value of number is less than -295, Exp returns zero (0).

## Description

The Exp function takes the natural log constant e and raises it to the power specified by the number argument. The constant e (Exp(1)) is approximately 2.718282.

The Exp function complements the action of the Log function and is sometimes referred to as the antilogarithm.

In ObjectScript, the corresponding function is \$ZEXP.

## Examples

The following example uses the Exp function to calculate e raised to the power of each of the integers -10 through 10:

```For x = -10 To 10
Println "Natural log of ",x," = ",Exp(x)
Next```

The following example uses the Exp function to return the hyperbolic sine of an angle:

```Dim MyAngle, MyHSin  ' Define angle in radians.
MyAngle = 1.3        ' Calculate hyperbolic sine.
MyHSin = (Exp(MyAngle) - Exp(-1 * MyAngle)) / 2
Println MyHSin```