1. Math.abs() : Membuat nilai absolut (mutlak)
Contoh: int cth2 = Math.abs(-35);
Source Code:
Hasil Compile:
2. Trigonometri
- Math.cos() : Mencari nilai cos
- Math.sin() : Mencari nilai sin
- Math.tan() : Mencari nilai tan
Contoh:
double cth1 = Math.cos(90);
double cth2 = Math.sin(90);
double cth2 = Math.sin(90);
double cth3 = Math.tan(90);
Source Code:
Hasil Compile:
Hasil Compile:
3. Pembulatan
- Math.ceil() : Pembulatan keatas pada sebuah bilangan decimal
- Math.floor() : Pembulatan kebawah pada sebuah bilangan decimal
Contoh:
double cth_ceil = Math.ceil(8.4923823);double cth_floor = Math.floor(8.87628);
Source Code:
Hasil Compile:
No comments:
Post a Comment