📄 mathtest.java
字号:
public class MathTest{
public static void main(String args[]){
System.out.println (Math.abs (-5.8)); //5.8
System.out.println (Math.ceil (3.2)); //4
System.out.println (Math.floor (3.8)); //3
System.out.println (Math.round (3.8)); //4
System.out.println (Math.round (3.2)); //3
System.out.println (Math.min (3,2)); //2
System.out.println (Math.max (Math.PI,4)); //4
System.out.println (Math.log (7.0)); //1.94591
System.out.println (Math.pow (7,2)); //72 ---- 49
System.out.println (Math.exp (0.4)); //1.49183
System.out.println (Math.IEEEremainder(10.0,3.0)); //返回1
double angle = 0.785398; //以弧度为单位的角,π/4
System.out.println (Math.tan (angle)); //返回该角的正切
System.out.println (Math.asin(0.707107)); //返回反余弦
System.out.println ("e is:"+ Math.E); // e is:2.71828
System.out.println ("πis:"+Math.PI); //πis:3.14159
System.out.println(Math.random()); //产生0和1(不含1)之间的伪随机数
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -