uint int Number
Flex 四舍五入:
整数的四舍五入法,Math.round(一个Number类型的数)
小数的有 tofixed(uint) 方法
例如 var num:Number = 56.159;
num.tofixed(2); 它是个String的类型,意思是保留两位小数。并且四舍五入,得 56.16
在flex中要实现一个数的四舍五入并取整的算法主要用到Math.round
trace(Math.round(204.499)); //输出:204
trace(Math.round(401.5)); //输出:402
本文介绍在Flex中如何使用Math.round进行整数的四舍五入,并通过tofixed方法处理小数部分,实现精确的数据处理。
317





