Oracle 5.0 Reference Manual page 931

Table of Contents

Advertisement

mysql>
SELECT LOG(2,65536);
-> 16
mysql>
SELECT LOG(10,100);
-> 2
mysql>
SELECT LOG(1,100);
-> NULL
[910]
is equivalent to
LOG(B,X)
[911]
LOG2(X)
Returns the base-2 logarithm of X.
mysql>
SELECT LOG2(65536);
-> 16
mysql>
SELECT LOG2(-100);
-> NULL
[911]
is useful for finding out how many bits a number requires for storage. This function is
LOG2()
equivalent to the expression
[911]
LOG10(X)
Returns the base-10 logarithm of X.
mysql>
SELECT LOG10(2);
-> 0.30102999566398
mysql>
SELECT LOG10(100);
-> 2
mysql>
SELECT LOG10(-100);
-> NULL
[911]
is equivalent to
LOG10(X)
[911],
MOD(N,M)
Modulo operation. Returns the remainder of
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
[911]
also works on values that have a fractional part and returns the exact remainder after
MOD()
division:
mysql>
SELECT MOD(34.5,3);
-> 1.5
[911]
returns NULL.
MOD(N,0)
[911]
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();
-> 3.141593
mysql>
SELECT PI()+0.000000000000000000;
-> 3.141592653589793116
Mathematical Functions
LOG(X) / LOG(B)
LOG(X) / LOG(2)
LOG(10,X)
[907],
N % M
N MOD M
values.
BIGINT
911
[910].
[910].
[910].
[907]
divided by M.
N

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents