exp()

The exp() function returns Euler's number e (approximately 2.71828) raised to the power of the specified value.

Syntax

exp(NUM_EXPR)

Parameters

NUM_EXPR
A numeric expression to use as the exponent.

Description

The exp() function applies Math.exp() to the input and returns the result as a 64-bit double. If the input is a Number type, it is internally converted using doubleValue() before processing.

Returns null if the input is null or not a number.

Error codes

N/A

Usage examples

  1. Calculate e to the power of 1.

    json "{'val': 1}" | eval result = exp(val)
    | # result: 2.718281828459045
    
  2. Calculate e to the power of 2.

    json "{'val': 2}" | eval result = exp(val)
    | # result: 7.38905609893065
    
  3. NULL input

    json "{'val': null}" | eval result = exp(val)
    | # result: null
    

Compatibility

The exp() function is available since before Sonar 4.0.