ã¿ããªä½ã£ã¦ãã®ããªï¼ package { public class MathExt { public static function round(num:Number, round:int=0):Number { var pow:int = Math.pow(10, round); return (Math.round(num * pow) / pow); } } } å®è¡çµæ MathExt.round(0.4, 0); => 0 MathExt.round(0.5, 0); => 1 MathExt.round(0.04, 1); => 0 MathExt.round(0.05, 1); => 0.1 MathExt.round(0.004, 2); => 0 MathExt.round(0.005, 2); => 0.01
{{#tags}}- {{label}}
{{/tags}}