๐Ÿ’ป

Java ํ”„๋กœ๊ทธ๋ž˜๋ฐ - [๊ธฐ๋ณธ API ํด๋ž˜์Šค] Math ํด๋ž˜์Šค ๋ณธ๋ฌธ

KITRI/JAVA

Java ํ”„๋กœ๊ทธ๋ž˜๋ฐ - [๊ธฐ๋ณธ API ํด๋ž˜์Šค] Math ํด๋ž˜์Šค

๋˜ํšจ๋‹ˆ 2020. 5. 13. 14:45
๋ฉ”์†Œ๋“œ ์„ค๋ช… ์˜ˆ์ œ ์ฝ”๋“œ ๋ฆฌํ„ด๊ฐ’
int abs(int a)
double abs(dobule a)
์ ˆ๋Œ€๊ฐ’ int v1 = Math.abs(-5);
double v2 = Math.abs(-3.14);
v1 = 5
v2 = 3.14
double ceil(double a) ์˜ฌ๋ฆผ๊ฐ’ double v3 = Math.ceil(5.3);
double v4 = Math.ceil(-5.3);
v3 = 6.0;
v4 = -5.0;
double floor(double a) ๋ฒ„๋ฆผ๊ฐ’ double v5 = Math.floor(5.3);
double v6 = Math.floor(-5.3);
v5 = 5.0
v6 = -6.0
int max(int a, int b)
double max(double a, double b)
์ตœ๋Œ€๊ฐ’ int v7 = Math.max(5.9);
double v8 = Math.max(5.3, 2.5);
v7 = 9
v8 = 5.3
int min(int a, int b)
double min(double a, double b)
์ตœ์†Œ๊ฐ’ int v9 = Math.min(5.9);
double v10 = Math.min(5.3, 2.5);
v9 = 5
v10 = 2.5
double random() ๋žœ๋ค๊ฐ’ double v11 = Math.random(); 0.0 <= v11 <= 1.0
double rint(double a) ๊ฐ€๊นŒ์šด ์ •์ˆ˜์˜ ์‹ค์ˆ˜๊ฐ’ double v12 = Math.rint(5.3);
double v13 = Math.rint(5.7);
v12 = 5
v13 = 6
long round(double a) ๋ฐ˜์˜ฌ๋ฆผ๊ฐ’ long v14 = Math.round(5.3);
long v15 = Math.round(5.7);
v14 = 5
v15 = 6

 

 

 

 

 

 

๋กœ๋˜ ํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“ค๊ธฐ (์ค‘๋ณต์ œ๊ฑฐ๋Š” ํ•˜์ง€์•Š์•˜๋‹ค)

๋ฐ˜์‘ํ˜•
Comments