1.舍掉小数取整
math.floor(3.5 )=3 2.四舍五入取整
math.rint(3.5 )=4 3.进位取整
math.ceil(3.1 )=4 4.取绝对值
math.ABS(-3.5 )=3.5 5.保留两位小数
双精度f=0.93333; string.format('%.2f ',f ); //f=0.93 Math的一些其他用法
math.sqrt(16 ) /平方根4Math.cbrt(8)8) /立方根2math.pow ) 3,2 ) /计算a的b次方9math.max ) 1,2,3 ); //计算最大值3 math.min (1,2,3 ); //最小值1 Collections的一些用法
取list集合的最大值和最小值的intmax=collections.max(list ); intmin=collections.min(list;