LOG2()

Description

LOG2(X) returns the base-2 logarithm of X.

Syntax

1. > LOG2(X)

Arguments

Arguments Description
X Required. Any numeric data type supported now.

Examples

1. drop table if exists t1;
2. create table t1(a float, b float);
3. insert into t1 values(1024,17.231);
4. insert into t1 values(4096,23.331);

6. mysql>select log2(a),log2(b) from t1;
7. +---------+-------------------+
8. | log2(a) | log2(b)           |
9. +---------+-------------------+
10. |      10 | 4.106934600972237 |
11. |      12 | 4.544176200820541 |
12. +---------+-------------------+
13. 2 rows in set (0.01 sec)