1. Discard the fractional part and retain the integer part.
Parseint (5/2)
2. rounded up. If there is a decimal number, add 1 to the integer part.
Math. Ceil (5/2)
3. rounding.
Math. Round (5/2)
4. Round down
Math. Floor (5/2)
Math object Method
FF: Firefox, N: Netscape, ie: Internet Explorer
Method description FF n ie
ABS (x) returns the absolute value of the number 1 2 3
ACOs (x) returns the inverse cosine of numbers 1 2 3
Asin (x) returns the inverse sine value of the number 1 2 3
Atan (x) returns the arc tangent of X with a value between-PI/2 and PI/2 radian. The value is 1 2 3.
Atan2 (Y, x) returns the angle (between-PI/2 and PI/2 radian) from the X-axis to the point (x, y). 1 2 3
Ceil (x) rounds up a number. 1 2 3
Cos (x) returns the cosine of the number 1 2 3
Exp (x) returns the e index. 1 2 3
Floor (X) is used to remove a number. 1 2 3
Log (x) returns the natural logarithm of the number (Base E) 1 2 3
Max (x, y) returns the highest value of 1 2 3 in X and Y.
Min (x, y) returns the minimum value of 1 2 3 in X and Y.
Pow (x, y) returns X's y power 1 2 3
Random () returns 0 ~ Random number between 1 1 2 3
Round (x) rounds a number to the nearest integer 1 2 3.
Sin (x) returns the sine of the number 1 2 3
SQRT (x) returns the square root of the number 1 2 3
Tan (x) returns the tangent of an angle 1 2 3
Tosource () indicates the source code of the object 1 4-
Valueof () returns the original value of a math object.
1. Math. Abs (Num ):
Returns the absolute value of num.
2. Math. ACOs (Num): returns the arc cosine of num.
3. Math. asin (Num): returns the arc sine of num.
4. Math. atan (Num): returns the arc tangent of num.
5. Math. atan2 (Y, X): returns the arc tangent value of the quotient dividing y by X.
6. Math. Ceil (Num): returns the smallest integer greater than num.
7. Math. Cos (Num): returns the cosine of num.
8. Math. exp (x): returns the number of X power based on the natural number.
9. Math. Floor (Num): returns the maximum integer smaller than num.
10. Math. Log (Num): returns the natural logarithm of num.
11. Math. Max (num1, num2): return a larger value in num1 and num2.
12. Math. Min (num1, num2): return a smaller value in num1 and num2.
13. Math. Pow (x, y): returns the value of X to the power of Y.
14. Math. Random (): returns a random number between 0 and 1.
15. Math. Round (Num): returns the value after num rounding.
16. Math. Sin (Num): returns the sine of num.
17. Math. SQRT (Num): returns the square root of num.
18. Math. Tan (Num): returns the tangent of num.
19. Math. E: Natural Number (2.718281828459045)
20. Math. ln2: natural logarithm of 2 (0.6931471805599453)
21. Math. ln10: natural logarithm of 10 (2.302585092994046)
22. Math. log2e: The base Natural Number of log 2 (1.4426950408889634)
23. Math. log10e: The base Natural Number of log 10 (0.4342944819032518)
24. Math. Pi: π (3.141592653589793)
25. Math. sqrt1_2: 1/2 square root (0.7071067811865476)
26. Math. sqrt2: square root of 2 (1.4142135623730951)