Mathematical functions - logarithmic

Logarithmic mathematical functions operate on numeric expressions only, and will return an error if used on any other values. See also Mathematical operators.

e()

e() returns the base of the natural logarithm, e.

Syntax:

e()

Returns:

FLOAT

Example 1. e()
Query
RETURN e()

The base of the natural logarithm, e, is returned.

Table 1. Result
e()

2.718281828459045

Rows: 1

exp()

exp() returns en, where e is the base of the natural logarithm, and n is the value of the argument expression.

Syntax:

e(expression)

Returns:

FLOAT

Arguments:

Name Description

expression

A numeric expression.

Considerations:

exp(null) returns null.

exp() returns Infinity when the return value is greater than the largest FLOAT value (Java Double.MAX_VALUE).

Example 2. exp()
Query
RETURN exp(2)

e to the power of 2 is returned.

Table 2. Result
exp(2)

7.38905609893065

Rows: 1

log()

log() returns the natural logarithm of a number.

Syntax:

log(expression)

Returns:

FLOAT

Arguments:

Name Description

expression

A numeric expression.

Considerations:

log(null) returns null.

log(0) returns -Infinity.

If (expression < 0), then (log(expression)) returns NaN.

Example 3. log()
Query
RETURN log(27)

The natural logarithm of 27 is returned.

Table 3. Result
log(27)

3.295836866004329

Rows: 1

log10()

log10() returns the common logarithm (base 10) of a number.

Syntax:

log10(expression)

Returns:

FLOAT

Arguments:

Name Description

expression

A numeric expression.

Considerations:

log10(null) returns null.

log10(0) returns -Infinity.

If (expression < 0), then (log10(expression)) returns NaN.

Example 4. log10()
Query
RETURN log10(27)

The common logarithm of 27 is returned.

Table 4. Result
log10(27)

1.4313637641589874

Rows: 1

sqrt()

sqrt() returns the square root of a number.

Syntax:

sqrt(expression)

Returns:

FLOAT

Arguments:

Name Description

expression

A numeric expression.

Considerations:

sqrt(null) returns null.

If (expression < 0), then (sqrt(expression)) returns NaN.

Example 5. sqrt()
Query
RETURN sqrt(256)

The square root of 256 is returned.

Table 5. Result
sqrt(256)

16.0

Rows: 1