-- 四捨五入。実数numを、小数idp桁で丸める。 function math.round(num, idp) if idp and idp>0 then local mult = 10^idp return math.floor(num * mult + 0.5) / mult end print(num, idp) return math.floor(num + 0.5) end