function round(arg) {
var temp = arg < 0 ? -arg : arg,
round_x = (10 * temp) % 10,
round_D = arg % 1;
if (round_x < 5) {
return arg - round_D;
} else {
return arg - round_D + (arg > 0 ? 1 : -1);
}
}
js,javascript四舍五入round
最新推荐文章于 2023-08-28 14:15:47 发布