MySQL Tutorial/Math Numeric Functions/LOG2
Версия от 13:44, 26 мая 2010; (обсуждение)
LOG2(X) returns the base-2 logarithm of X
If called with two parameters, this function returns the logarithm of X for an arbitrary base B.
mysql>
mysql> SELECT LOG(2,65536);
+--------------+
| LOG(2,65536) |
+--------------+
| 16 |
+--------------+
1 row in set (0.00 sec)
mysql> SELECT LOG(10,100);
+-------------+
| LOG(10,100) |
+-------------+
| 2 |
+-------------+
1 row in set (0.01 sec)
mysql>
LOG(B,X) is equivalent to LOG(X) / LOG(B).
mysql>