I’m John C Bland II

Husband, Father, Tech Author, Deacon.
Founder of Katapult Media, and full-stack polyglot developer.
Political Free Agents Podcast Host.

I create. I launch.

YouTube Channel

I post regular fun on YouTube like me playing the bass and anything else I find fun. 

Get Something Built

All project work goes through Katapult Media. Business is open. Let’s chat.

This really would work in any language, heck even on paper, but the code will be AS3 so figured I’d label it an AS3 post. Short and sweet though…here is how you can round to the nearest number in ActionScript.

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

Essentially you divide by the number you want to round to which will give you a decimal number. Then round that (essentially removing the decimal) and multiple by the rounding number to get you right back to where you were.


  1. roundToNearest(100, 3745);
  2. 3745/100 = 37.45
  3. Math.round(37.45) //37
  4. 37*100 = 3700

That’s it. Hope this helps someone.