Java.lang.Math provides some column static methods for scientific calculations, and the parameters and return value types of the methods are generally double type.
ABS: Absolute value;
Acos,asin,atan,cos,sin,tan;
sqrt: square root;
Pow (double a,double b) a power of B;
LOG: Natural logarithm
Exp:e for base Index
Max (double a,double b): Take maximum value
Min (double a,double b): Minimum value to go
Random (): Returns the number 0.0 to 1.0
Long round (double A): Data A of type double is converted to long (rounded)
Todegrees (double Angrad): radians converted to angles
Toradians (double angdeg): Angle converted to radians
Package mymathclass;
public class Test {
public static void Main (string[] args) {
TODO auto-generated Method Stub
Double A=math.random ();
Double B=math.random ();
System.out.println (Math.sqrt (a*a+b*b));
System.out.println (Math.pow (A, 8));
System.out.println (Math.Round (b));
System.out.println (Math.log (Math.pow (MATH.E, 15));
Double D=60.0,r=math.pi/4;
System.out.println (Math.toradians (d));
System.out.println (Math.todegrees (R));
System.out.println (MATH.E);
System.out.println (Math.PI);
}
}
This article is from the "one step, one step" blog, please be sure to keep this source http://summerflowers.blog.51cto.com/5202033/1926265
Basic Java Math Class (10)