5시간코딩

숫자 본문

문제풀기/공통기초부분

숫자

5시간코딩 2019. 4. 3. 09:23

1. oracle

select round(45.926,2), round(45.926,1), round(45.926,0), round(45.926), round(45.926,-1) from dual;

select trunc(45.925,2), trunc(45.925,1), trunc(45.925,0), trunc(45.925), trunc(45.925,-1) from dual;
select ceil(10.1), ceil(10.999), ceil(10.0001), ceil(10.0) from dual;     --> ceil(10.0)은 10나오고 나머지는 다 11 나옴

select floor(10.1), floor(10.999), floor(10.0001), floor(10.0) from dual;    --> 다 10나옴. trunc(~~,0)과 같음

select mod(12,5) from dual; --> 결과 2

select power(10,3) , sqrt(100) from dual;

--이 외에도 훨씬 더 많음

 

2. r

round(45.926);round(45.926,0);round(45.926,1);round(45.926,2);round(45.926,-1);round(45.926,-2);

trunc(45.926)

signif(45.926);signif(45.926,1);signif(45.926,2);signif(45.926,3);signif(45.926,6);

ceiling(45.926);ceiling(45.0001);ceiling(45.0)

floor(45.926);floor(45.0) #trunc와 floor의 차이가 없는데... trunc 의 경우 나중에 숫자값 들어와도 무시해야할 때 쓴다고 함.

10**3;10^3;e3

abs(1); abs(-1)

sqrt(16); sqrt(64); sqrt(-64) #결과:NaN(허수)

 

3. python

round(45.926,2), round(45.926,1), round(45.926,0), round(45.926), round(45.926,-1)

trunc(45.925,2), trunc(45.925,1), trunc(45.925,0), trunc(45.925), trunc(45.925,-1)

math.ceil(10.1), math.ceil(10.999), math.ceil(10.0001), math.ceil(10.0)

math.floor(10.1), math.floor(10.999), math.floor(10.0001), math.floor(10.0)

q, r = divmod(12,5) #결과값 2개

import math

math.sqrt(16)

math.pow(2,4)

 

math in python 구글 검색하면 엄청 많이 나옴

sin cos tan 등....

'문제풀기 > 공통기초부분' 카테고리의 다른 글

날짜  (0) 2019.04.03
문자  (0) 2019.04.03
불린  (0) 2019.04.03
data export, import  (0) 2019.03.29
자료형  (0) 2019.03.27