rounding numbers to decimal places


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.