EXP

The EXP function returns a value that is the base of the natural logarithm (e) raised to a power specified by the argument. The EXP and LN functions are inverse operations.

Read syntax diagramSkip visual syntax diagramEXP (expression)
expression
An expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information about converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE.

If the data type of the argument is DECFLOAT(n), the result is DECFLOAT(n). Otherwise, the data type of the result is double-precision floating point. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Note

Results involving DECFLOAT special values: For decimal floating-point values the special values are treated as follows:
  • EXP(NaN) returns NaN.
  • EXP(-NaN) returns -NaN.
  • EXP(Infinity) returns Infinity.
  • EXP(-Infinity) returns 0.
  • EXP(sNaN) and EXP(-sNaN) return a warning or error. 1

Example

  • Assume the host variable E is a DECIMAL(10,9) host variable with a value of 3.453789832.
      SELECT EXP(:E)
        FROM SYSIBM.SYSDUMMY1
    Returns the approximate value 31.62.
1 If *YES is specified for the SQL_DECFLOAT_WARNINGS query option, NaN and -NaN are returned respectively with a warning.