
Math.sin() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
613
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 frac-
tional portion less than or equal to 0.5, are rounded up.
Example
Math.round(1.4); // Returns 1
Math.round(1.5); // Returns 2
Math.round(1.6); // Returns 2
Math.round(-5.4); // Returns -5
Math.round(-5.5); // Returns -5
Math.round(-5.6); // Returns -6
See Also
int( ), Math.ceil( ), Math.floor( )
Math.sin() Method
compute the sine of an angle
Flash 5; can be used when exporting Flash 4 movies
Math.sin(theta)
Arguments
theta An angle, in radians (not degrees), normally in the range of 0 to 2π, although
any angle will suffice, as sine is a periodic function.
Returns
The sine of theta (the result is in the range of –1.0 to 1.0).
Description
The sin( ) method