-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestMath.java
More file actions
23 lines (20 loc) · 772 Bytes
/
Copy pathTestMath.java
File metadata and controls
23 lines (20 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class TestMath {
public static void main(String args[]) {
System.out.println("90的正xuan值" + Math.sin(Math.PI / 2));
System.out.println("0度的余xuan值" + Math.cos(0));
System.out.println("60度的正切值" + Math.tan(Math.PI / 2));
System.out.println("1的正反切值" + Math.atan(1));
System.out.println("Math.PI");
}
double[] nums = { 1.4, 1.5, 1.6, -1.4, -1.5, -1.6 };for(
double num:nums)
{
test(num);
}
}
private static void test(double num) {
System.out.println("Math.floor(" + num + ")=" + Math.floor(num));
System.out.println("Math.round(" + num + ")=" + Math.round(num));
System.out.println("Math.ceil(" + num + ")=" + Math.ceil(num));
}
}