round the number with decimals
round the number with decimals
This is the sample script to show how to use the class
import druva.NumberUtil; trace(NumberUtil.roundTo(25.85688, 2));
Actual Class
package druva{
import flash.display.Sprite;
public class NumberUtil extends Sprite {
public function NumberUtil() {
}
//@ round to number of decemals
public static function roundTo(number, precision) {
return (Math.round(number * Math.pow(10, precision)) / Math.pow(10, precision));
}
}
}