-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMathDemo.java
89 lines (46 loc) · 2.21 KB
/
MathDemo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package mathdemo;
public class MathDemo
{
public static void main(String[] args)
{
System.out.print("Absolute :");
System.out.println(Math.abs(-123));
System.out.print("Absolute :");
System.out.println(StrictMath.abs(-123));
System.out.print("Cube Root :");
System.out.println(Math.cbrt(27));
System.out.print("Exact Decrement :");
// System.out.println(Math.decrementExact(Integer.MIN_VALUE));
int i=Integer.MIN_VALUE;
i--;
System.out.println(i);
System.out.print("Exponent value in Floating Point Rep. :");
System.out.println(Math.getExponent(123.45));
System.out.print("Round Division :");
System.out.println(Math.floorDiv(50, 9));
System.out.print("e power x :");
System.out.println(Math.exp(1));
System.out.print("e power x :");
System.out.println(StrictMath.exp(1));
System.out.print("Log base 10 :");
System.out.println(Math.log10(100));
System.out.print("Maximum :");
System.out.println(Math.max(100, 50));
System.out.print("Tan :");
System.out.println(Math.tan(45*Math.PI/180));
System.out.print("Convert to Radians :");
System.out.println(Math.toRadians(90));
System.out.print("Convert to Degree :");
System.out.println(Math.toDegrees(Math.atan(1)));
System.out.print("Convert To Degree :");
System.out.println(StrictMath.toDegrees(StrictMath.tanh(1)));
System.out.print("Random :");
System.out.println(Math.random()*1000);
System.out.print("Power :");
System.out.println(Math.pow(2, 3));
System.out.print("Excact Product :");
System.out.println(Math.multiplyExact(100, 200));
System.out.print("Next Float Value :");
System.out.println(Math.nextAfter(12.5, 11));
}
}