1. Discard the fractional part and keep the whole number of parts
parseint (5/2)
2. Take up the whole, there are decimal numbers on the whole part plus 1
Math.ceil (5/2)
3, rounded.
Math.Round (5/2)
4, take the whole 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 inverse cosine of a number. |
1 |
3 |
| ASIN (x) |
Returns the inverse chord value of a number. |
1 |
3 |
| Atan (x) |
Returns the inverse tangent of x to the value between-PI/2 and PI/2 radians. |
1 |
3 |
| ATAN2 (y,x) |
Returns the angle (between-PI/2 and PI/2 radians) from the X axis to point (X,y). |
1 |
3 |
| Ceil (x) |
The logarithm is rounded up. |
1 |
3 |
| COS (x) |
Returns the cosine of a number. |
1 |
3 |
| EXP (x) |
Returns the index of E. |
1 |
3 |
| Floor (x) |
The logarithm is rounded down. |
1 |
3 |
| Log (x) |
Returns the natural logarithm of the number (the bottom is 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 Y-power of X. |
1 |
3 |
| Random () |
Returns the random number between 0 ~ 1. |
1 |
3 |
| Round (x) |
Round the number to the nearest integer. |
1 |
3 |
| Sin (x) |
Returns the sine of a 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 for this object. |
1 |
- |
| ValueOf () |
Returns the original value of the Math object. |
1 |
4 |