Java has a very useful tool class, you can less than a lot of if else to judge, but not many people use, published this article is intended to let many people use this tool class, improve code quality and force lattice
Math.PI returns the recorded pi
MATH.E returns the constant of record E
Math.Abs return Absolute Value
Math.sin return sine function math.asin inverse chord function
Math.Cos return cosine function math.acos inverse cosine function
Math.tan return tangent function Math.atan inverse tangent function The inverse tangent function of the math.atan2 quotient
Math.todegrees return radian to angle Math.toradians angle to radians
Math.ceil returns the largest integer that is not less than a certain number
For example
Math.ceil (10.2) = 11;
Math.ceil (-10.2) =-10;
Math.floor returns the largest integer not greater than a number
For example
Math.floor (10.2) = 10;
Math.floor (-10.2) =-11;
Math.exp returns any of the second sides of E
MATH.LOG10 returns the logarithm with a 10 base
Math.log returns the natural logarithm
Math.rint returns the nearest integer from a number
For example:
Math.rint (10.5) = 10.0;
Math.rint (10.4) = 10.0;
Math.rint (10.6) = 11.0;
Math.Round rounding returns an int or a long type (the previous function returns a double type)
Math.random returns a random number between 0 and 1.
Math.ieeeremainder (x,y) return x%y value
Math.max returns the largest of the two numbers
Math.min returns the smallest of two digits
Math.sqrt return to Root
Math.pow returns a number of any secondary party
MATH.SQRT (x): Returns the square root
Math.pow (X,y): Returns the Y-second side of X
Math.nextdown (x) 0.00001 smaller than x
Math.nextup (x) 0.00001 larger than X
Math.addexact (1, 2); Addition operations
Math.subtractexact (3, 5); subtraction operation
Math.multiplyexact (2, 4); Multiplication operations
Math.scalb (6, 3); Represents 6 * (2 of 3)