LN
Returns natural (base e) logarithm of a numerical expression. The value for which ln
is computed needs to be larger than 0, otherwise an error is returned. You can use the function LOG if you want to provide a different base.
Syntax
LN(<value>);
Parameters
Parameter | Description | Supported input types |
---|---|---|
<value> | The value for which to compute the natural logarithm. | DOUBLE PRECISION |
Return Type
DOUBLE PRECISION
Examples
Example
The following code example computes the natural logarithm of 1.0:
SELECT LN(1.0);
Returns
0.0
Example
The following code example returns the natural logarithm close to e:
SELECT LN(2.7182818284590452353);
Returns
1.0
Example
The natural logarithm can only be computed for values that are larger than 0. All the following functions return an error:
SELECT LN(0.0);
SELECT LN(-1.0);
SELECT LN('-Inf');