Skip to main content

LOG10

Description

Returns the natural logarithm of x to base 10.

Alias

  • DLOG10

Syntax

LOG10(<x>)

Parameters

ParameterDescription
<x>Antilogarithm should be greater than 0

Return value

Returns a floating-point number. Special cases:

  • If x IS NULL, return NULL
  • If x IS NaN, return NaN

Example

select log10(1);
+--------------------------+
| log10(cast(1 as DOUBLE)) |
+--------------------------+
| 0.0 |
+--------------------------+
select log10(10);
+---------------------------+
| log10(cast(10 as DOUBLE)) |
+---------------------------+
| 1.0 |
+---------------------------+
select log10(16);
+---------------------------+
| log10(cast(16 as DOUBLE)) |
+---------------------------+
| 1.2041199826559248 |
+---------------------------+
select log10(NULL);
+-------------+
| log10(NULL) |
+-------------+
| NULL |
+-------------+
select log10(cast('nan' as double));
+------------------------------+
| log10(cast('nan' as double)) |
+------------------------------+
| NaN |
+------------------------------+