Oracle Numerical Function Encyclopedia (excluding trigonometric functions)

--Complete list of numerical functions
--1.abs(x) returns the absolute value of x
select abs(-2.1) from dual;

--2.mod(x,y)      取余
select mod(5,2) from dual;


--3.sign(x) returns positive and negative values
​​--x>o, then return 1
select sign(10) from dual; 


--x=0, then return 0
select sign(0) from dual;


--x<0, then return -1
select sign(-10) from dual; 


--4.ceil(x) round up (relative to the upper [front] of the axis of symmetry)
select ceil(2.3) from dual;

 select ceil(-2.3) from dual;


--5.floor(x) round down (relative to the lower [back] of the symmetry axis)
select floor(2.1) from dual;


select floor(-1.7) from dual; 


--6.power(x,y) returns x to the power of y
select power(4,2) from dual;

--7.exp(y) returns e to the power of y
select exp(2) from dual;


--8.ln(y) Returns the natural logarithm of y with e as the base (returns the natural logarithm with e as the base and y as the real number)
select ln(3) from dual;


--9.log(x,y) returns the logarithm of y based on x
select log(2,8) from dual;

--10.round(a,n) returns the rounded value
--n>o , to round off the decimal place, n=1 is to keep one decimal place, and n=2 is to keep two decimal places. . .
select round(455.887,1) from dual;


--n=0, return an integer (do not keep decimals, accurate to integer digits)

select round(455.987,0) from dual;

 
--n<0, rounding for integer digits, n=-1 is accurate to one digit, n=-2 is accurate to ten digits
select round(455.987,-2) from dual;

--11.trunc(x,n) returns the value of x intercepted by precision n (accuracy judgment is the same as round, but trunc directly intercepts without rounding) --n>0, intercepts
by decimal precision
select trunc(44.567, 1) from dual;


--n=0, intercept integer

select trunc(44.567,0) from dual;


--n<0, intercept according to integer digit precision (accuracy judgment is the same as round, but trunc directly intercepts without rounding)
select trunc(48.567,-1) from dual;


--12.sqrt(x) returns the square root of x (x>=0)
select round(sqrt(2),3) from dual;

Accurate to the third decimal place of the square root. 

Guess you like

Origin blog.csdn.net/lxslf/article/details/130810349