Mathematical functions - logarithmic

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

Functions:

1. e()

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

Syntax: e()

Returns:

A Float.

Query
RETURN e()

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

Table 1. Result
e()

2.718281828459045

1 row

2. exp()

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

Syntax: e(expression)

Returns:

A Float.

Arguments:

Name Description

expression

A numeric expression.

Considerations:

exp(null) returns null.

Query
RETURN exp(2)

e to the power of 2 is returned.

Table 2. Result
exp(2)

7.38905609893065

1 row

3. log()

log() returns the natural logarithm of a number.

Syntax: log(expression)

Returns:

A Float.

Arguments:

Name Description

expression

A numeric expression.

Considerations:

log(null) returns null.

log(0) returns null.

Query
RETURN log(27)

The natural logarithm of 27 is returned.

Table 3. Result
log(27)

3.295836866004329

1 row

4. log10()

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

Syntax: log10(expression)

Returns:

A Float.

Arguments:

Name Description

expression

A numeric expression.

Considerations:

log10(null) returns null.

log10(0) returns null.

Query
RETURN log10(27)

The common logarithm of 27 is returned.

Table 4. Result
log10(27)

1.4313637641589874

1 row

5. sqrt()

sqrt() returns the square root of a number.

Syntax: sqrt(expression)

Returns:

A Float.

Arguments:

Name Description

expression

A numeric expression.

Considerations:

sqrt(null) returns null.

sqrt(<any negative number>) returns null

Query
RETURN sqrt(256)

The square root of 256 is returned.

Table 5. Result
sqrt(256)

16.0

1 row