MySQL tutorial: LOG2 [EN]
top of page
CerebroSQL

MySQL: 

LOG2

Syntax:
LOG2(X)

Returns the base-2 logarithm of X. If X is less than or equal to 0.0E0,
the function returns NULL and a warning "Invalid argument for
logarithm" is reported.

URL: https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html

Example

mysql> SELECT LOG2(65536);
-> 16
mysql> SELECT LOG2(-100);
-> NULL

bottom of page