Hi guys!
I’ve used this site for years - it’s usally the top result when i’m looking for as2/flash help - i know your all experts so my question may sound stupid :ne:
All the guides/info on rounding decimals - do not do what i want, and i cannot work it out. The main guide is adobe itself…
http://kb2.adobe.com/cps/155/tn_15542.html
value= Math.round(20/7); // 0 DP - eg. 3
value= int((20/7)*10)/10; // 1 DP - eg. 2.8
value= int((20/7)*100)/100; // 2 DP - eg. 2.85
value= int((20/7)*1000)/1000; // 3 DP - eg. 2.857
value= int((20/7)*10000)/10000; // 4 DP - eg. 2.85 71
However, what i would want is, if the number is: 0.00189
To have a way to turn it into:
0DP = 1.00
1DP = 0.10
2DP = 0.103DP = 0.002
4DP = 0.0019
The code from adobe would produce this:
0DP = 0
1DP = 0
2DP = 0
3DP = 0.001
4DP = 0.0018
I think adobe’s code just CUTs the number off a the DP - where as i would like it to round up to the nearest DP. It’s for working with $$$.
Thanks so much for reading this long post!
Cheers!