Return to Snippet

Revision: 29326
at July 27, 2010 05:01 by Winkyboy


Initial Code
function roundToNearest(roundTo:Number, value:Number):Number{
    return Math.round(value/roundTo)*roundTo;
}

Initial URL
http://www.johncblandii.com/index.php/2009/01/as3-rounding-to-nearest-n.html

Initial Description
syntax:

roundToNearest(45, YourValueHere);

Initial Title
AS3: Rounding to nearest N

Initial Tags
math

Initial Language
ActionScript 3