Navigator 2.0, Internet Explorer 3.0
Math.floor(x)
Any numeric value or expression.
The closest integer less than or equal to x.
Math.floor() computes the floor function--i.e., it returns the nearest integer value that is less than or equal to the function argument. Math.floor() rounds a floating-point value down to the closest integer. This differs from Math.round() which rounds up or down to the nearest integer. Also note that Math.floor() rounds negative numbers to be more negative, not closer to zero.
a = Math.floor(1.99); // result is 1.0 b = Math.floor(1.01); // result is 1.0 c = Math.floor(1.0); // result is 1.0 d = Math.floor(-1.01); // result is -2.0
This HTML Help has been published using the chm2web software. |