The methods of jsMath objects are rounded up, rounded down, rounded down, and so on. Numeric operations are often used. If you need them, refer to section 1. Discard the decimal 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, IE: Internet Explorer
Method |
Description |
FF |
IE |
Abs (x) |
Returns the absolute value of a number. |
1 |
3 |
Acos (x) |
Returns the arc cosine of a number. |
1 |
3 |
Asin (x) |
Returns the arc sine of the number. |
1 |
3 |
Atan (x) |
Returns the arc tangent value of x with a value between-PI/2 and PI/2 radian. |
1 |
3 |
Atan2 (y, x) |
Returns the angle from the x-axis to the point (x, y) (between-PI/2 and PI/2 radian ). |
1 |
3 |
Ceil (x) |
The logarithm is rounded up. |
1 |
3 |
Cos (x) |
Returns the cosine of the number. |
1 |
3 |
Exp (x) |
Returns the index of e. |
1 |
3 |
Floor (x) |
The logarithm is deprecated. |
1 |
3 |
Log (x) |
Returns the natural logarithm of the number (Base e ). |
1 |
3 |
Max (x, y) |
Returns the highest value in x and y. |
1 |
3 |
Min (x, y) |
Returns the lowest value in x and y. |
1 |
3 |
Pow (x, y) |
Returns the Power y of x. |
1 |
3 |
Random () |
Returns 0 ~ A random number between 1. |
1 |
3 |
Round (x) |
Round the number to the nearest integer. |
1 |
3 |
Sin (x) |
Returns the sine of the number. |
1 |
3 |
Sqrt (x) |
Returns the square root of a number. |
1 |
3 |
Tan (x) |
Returns the tangent of the angle. |
1 |
3 |
ToSource () |
Returns the source code of the object. |
1 |
- |
ValueOf () |
Returns the original value of the Math object. |
1 |
4 |