Posted By

Winkyboy on 07/27/10


Tagged

math as3 rounding


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

adrianparr
PixelJuice
tspitzr


AS3: Rounding to nearest N


 / Published in: ActionScript 3
 

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

syntax:

roundToNearest(45, YourValueHere);

  1. function roundToNearest(roundTo:Number, value:Number):Number{
  2. return Math.round(value/roundTo)*roundTo;
  3. }

Report this snippet  

You need to login to post a comment.