LOG
Descriptionβ
Returns the logarithm of x
based on base b
.
Syntaxβ
LOG(<a>,<x>)
Parametersβ
Parameter | Description |
---|---|
<a> | Base should be greater than 0 and not be exactly 1.0 |
<x> | Antilogarithm should be greater than 0 |
Return valueβ
Return a float point number. Special cases:
- If a IS NULL or x IS NULL, return NULL
Exampleβ
select log(5,1);
+---------------+
| log(5.0, 1.0) |
+---------------+
| 0 |
+---------------+
select log(3,20);
+--------------------+
| log(3.0, 20.0) |
+--------------------+
| 2.7268330278608417 |
+--------------------+
select log(2,65536);
+-------------------+
| log(2.0, 65536.0) |
+-------------------+
| 16 |
+-------------------+
select log(5,NULL);
+------------------------------+
| log(cast(5 as DOUBLE), NULL) |
+------------------------------+
| NULL |
+------------------------------+
select log(NULL,3);
+------------------------------+
| log(NULL, cast(3 as DOUBLE)) |
+------------------------------+
| NULL |
+------------------------------+