Java Math class

package hello;
//The sine value can directly look up the table above, or can be calculated by Math;
//Java's Math contains properties and methods for performing basic mathematical operations, such as elementary exponential, logarithm, square root and triangle function.

//Math's methods are all defined as static form, which can be called directly in the main function through the Math class.
public class test {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Sine of 90 degrees: "+ Math.sin(Math.PI/2));
System.out. println("The cosine of o degrees: "+ Math.cos(0));
System.out.println("The tangent of 60 degrees: "+Math.tan(Math.PI/3));
System.out. println("Arc tangent of 1: "+Math.atan(1));
System.out.println("The angle value of π/2"+Math.toDegrees(Math.PI/2));
System.out. println("Hello World");
System.out.println(Math.PI);
}

}

 

========================================

Sine of 90 degrees: 1.0
Cosine of o degrees: 1.0
Tangent of 60 degrees: 1.7320508075688767 Arctangent
of 1: 0.7853981633974483
Angle of π/2 90.0
Hello World
3.141592653589793

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347394&siteId=291194637