-> 16 mysql> SELECT LOG(10,100); -> 2 mysql> SELECT LOG(1,100); -> NULL 

LOG( B , X )  is equivalent to LOG( X ) / LOG( B ) . 

• 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. 

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

LOG2()  is useful for finding out how many bits a number requires for storage. This function is equivalent to the expression LOG( X ) / LOG(2) . 

• LOG10( X ) 

Returns the base-10 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. 

mysql> SELECT LOG10(2); -> 0.30102999566398 mysql> SELECT LOG10(100); -> 2 mysql> SELECT LOG10(-100); -> NULL 

LOG10( X )  is equivalent to LOG(10, X ) . 

• MOD( N , M ) , N  % M , N  MOD M 

Modulo operation. Returns the remainder of N  divided by M . 

mysql> SELECT MOD(234, 10); -> 4 mysql> SELECT 253 % 7; -> 1 mysql> SELECT MOD(29,9); -> 2 mysql> SELECT 29 MOD 9; -> 2 

This function is safe to use with BIGINT  values. 

MOD()  also works on values that have a fractional part and returns the exact remainder after division: 

mysql> SELECT MOD(34.5,3); -> 1.5 

MOD( N ,0)  returns NULL . 

• PI() 

Returns the value of π  (pi). The default number of decimal places displayed is seven, but MySQL uses the full double-precision value internally. 

mysql> SELECT PI(); 

