Exponential function (inverse of natural logarithm).
Examples
The following example demonstrates that $ZEXP is the inverse of $ZLN:
SET x=7
WRITE $ZEXP(x),!
WRITE $ZLN(x),!
WRITE $ZEXP($ZLN(x))
The following example returns $ZEXP for negative and positive integers and for zero. This example returns the constant e as $ZEXP(1):
FOR x=-3:1:3 {
WRITE !,"The exponential of ",x," = ",$ZEXP(x)
}
QUIT
returns:
The exponential of -3 = .04978706836786394297
The exponential of -2 = .1353352832366126919
The exponential of -1 = .3678794411714423216
The exponential of 0 = 1
The exponential of 1 = 2.718281828459045236
The exponential of 2 = 7.389056098930650228
The exponential of 3 = 20.08553692318766774
The following example uses IEEE floating point numbers ($DOUBLE numbers). The first $ZEXP returns a numeric value, the second $ZEXP returns “INF” (or <MAXNUMBER> depending on the IEEEError()Opens in a new tab method setting):
SET rtn=##class(%SYSTEM.Process).IEEEError(0)
WRITE $ZEXP($DOUBLE(1.0E2)),!
WRITE $ZEXP($DOUBLE(1.0E3))
The following example demonstrates that the empty string or a nonnumeric value is treated as 0:
WRITE $ZEXP(""),!
WRITE $ZEXP("INF")
both return 1.