Common constants and methods of the Java.math.Math class:
Math.PI recorded by pi
MATH.E Constants for Record E
Math.Abs Absolute Value
Math.sin sine function math.asin inverse chord function
Math.Cos cosine function Math.acos inverse cosine function
Math.tan tangent function Math.atan inverse tangent function The inverse tangent function of math.atan2 quotient
Convert math.todegrees radians to angles math.toradians angles to radians
Math.ceil get the largest integer not less than a certain number
Math.floor the largest integer less than a certain number
Example: Math.floor (12.7) =12.0
Math.ceil (12.7) =13.0
Ceil () is the ceiling, that is, rounding up. Floor is the ground, rounded down. Round is rounded.
Math.ieeeremainder to seek the remainder
Math.max two number of the largest
Math.min to find the smallest of two numbers
Math.sqrt to seek a prescription
Math.pow the arbitrary order of a number, throws a ArithmeticException handle overflow exception
MATH.SQRT (x): square root
Math.pow (x, y): x y-square
Math.exp the arbitrary order of E
MATH.LOG10 logarithm with base 10
Math.log Natural logarithm
Math.rint the nearest integer (perhaps larger or smaller than a certain number) from a certain number
Math.Round, return int or long (previous function returns double type)
Math.random returns a random number between 0 and 1.
Java.math.BigInteger (Large integer):
BigInteger bi1=new BigInteger ("1234567890123456890");
BigInteger bi2=biginteger.valueof (123L);
Bi1=bi1.add (BI2);//b1+b2
Bi1=bi1.multiply (BI2);//b1*b2
Bi1=bi1.subtract (BI2);//b1-b2
Bi1=bi1.divide (BI2);//B1/B2
Java.math.BigDecimal (large floating point):
BigDecimal bd = new BigDecimal ("3.1415926");
BD = Bd.setscale (2,bigdecimal.round_down);//Take 3.1415926 decimal points after two digits
Usage of the Math class