ActionScript for Flash MX: The Definitive Guide, 2nd Edition By Colin Moock
Chapter 18. ActionScript Language Reference
Math.round( ) Method
Flash 5; can be used when exporting Flash 4 movies
calculate the closest integer to a number
Math.round(x)
Arguments
x
A number.
Returns
The integer mathematically closest to x (or x itself, if x is an integer). If the fractional component of x is exactly 0.5 (x is equidistant from the two closest integers), round( ) returns the first integer greater than x.
Description
The round( ) method performs traditional rounding; it converts a floating-point number to the nearest integer. Positive numbers with a fractional portion less than 0.5, and negative numbers with a fractional portion greater than 0.5, are rounded down. Positive numbers with a fractional portion greater than or equal to 0.5, and negative numbers with a fractional portion less than or equal to 0.5, are rounded up.