Posted By

cessnajumpin on 05/18/09


Tagged

numbers decimal as3 rounding


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

shuchii
quan


rounding numbers to decimal places


 / Published in: ActionScript 3
 

URL: http://kb2.adobe.com/cps/155/tn_15542.html

I completely copied this from the Adobe site; but it's still a great reference.

  1. Code Number of Decimal Places Example Results
  2. value= Math.round(20/7); none 3
  3. value= int((20/7)*10)/10; 1 2.8
  4. value= int((20/7)*100)/100; 2 2.85
  5. value= int((20/7)*1000)/1000; 3 2.857
  6. value= int((20/7)*10000)/10000; 4 2.85 71

Report this snippet  

You need to login to post a comment.