VeloDB Cloud
SQL Manual
Functions
math-functions
log2

log2

Description

Syntax:

DOUBLE log2(DOUBLE x)

This function returns the logarithm of x to the base of 2.

Example

mysql> select log2(1);
+-----------+
| log2(1.0) |
+-----------+
|         0 |
+-----------+
mysql> select log2(2);
+-----------+
| log2(2.0) |
+-----------+
|         1 |
+-----------+
mysql> select log2(10);
+--------------------+
| log2(10.0)         |
+--------------------+
| 3.3219280948873622 |
+--------------------+

Keywords

LOG2