# Complicated Rounding

**URL:** <https://forum.kirupa.com/t/complicated-rounding/281154>\
**Category:** flash\
**Created:** [February 5, 2009, 3:47pm UTC](https://forum.kirupa.com/t/complicated-rounding/281154 "2009-02-05T15:47:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha\_Remex](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Alpha\_Remex](https://forum.kirupa.com/u/Alpha_Remex)\
**Post date:** [February 5, 2009, 3:47pm UTC](https://forum.kirupa.com/t/complicated-rounding/281154/1 "2009-02-05T15:47:11Z")

</div>

So here is my issue… I need to be able to round a given number to an even number that is divisible by 10, 100, or 1000 depending on it’s size.  
\*\*  
For example:\*\*

4 would be 0 – Round to nearest 10  
6 would be 10 – Round to nearest 10  
54 would be 50 – Round to nearest 10  
1440 would be 1400 – Round to nearest 100  
16777 would be 16700 – Round to nearest 100  
238498 would be 238000 – Round to nearest 1000  
4673829 would be 4674000 – Round to nearest 1000  
12384767 would be 12384000 – Round to nearest 1000

I’ve been scanning the WWW for a formula to do this in as3, but have come up empty handed.

Any ideas?  
-AR
