3.4.6. Mathematical functions - logarithmic

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

Functions:

3.4.6.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 3.163. Result
e()

1 row

2.718281828459045

Try this query live.  none RETURN e()

3.4.6.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 3.164. Result
exp(2)

1 row

7.38905609893065

Try this query live.  none RETURN exp(2)

3.4.6.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.165. Result
log(27)

1 row

3.295836866004329

Try this query live.  none RETURN log(27)

3.4.6.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 3.166. Result
log10(27)

1 row

1.4313637641589874

Try this query live.  none RETURN log10(27)

3.4.6.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 3.167. Result
sqrt(256)

1 row

16.0

Try this query live.  none RETURN sqrt(256)