JS only retains integers, rounded up, rounding, and rounding down functions
1. Discard the fractional part, preserving the whole number of parts
parseint (5/2)
2. Rounding up, with decimals on the integer part plus 1
Math.ceil (5/2)
3, rounded.
Math.Round (5/2)
4, rounding down
Math.floor (5/2)
Methods of the Math object
Method description
ABS (x) absolute value of the return number
ACOs (x) inverse cosine of the return number
ASIN (x) inverse sine value of the return number
Atan (x) returns the inverse tangent of x with a value between-PI/2 and PI/2 radians
ATAN2 (y,x) returns the angle from the x-axis to the point (X, y) (between-PI/2 and PI/2 radians)
Ceil (x) rounds a number.
COS (x) The cosine of the return number
EXP (x) returns the exponent of E.
Floor (x) rounds down a number.
Log (x) The natural logarithm of the number of returns (Bottom is E)
Max (x, y) returns the highest value in X and Y
Min (x, y) returns the lowest value in X and Y
Pow (x, y) returns the Y power of X
Random () returns the number 0 ~ 1
Round (x) rounding a number to the nearest integer
Sin (x) the sine of the number of returns
sqrt (x) The square root of the number of returns
Tan (x) returns the tangent of a corner
Tosource () represents the source code of the object
ValueOf () returns the original value of a Math object
JS rounding function toFixed (), the parameter is the number of digits reserved decimal.
JS rounding, rounding and other mathematical functions