Math.round(x) 四舍五入;Math.floor(x) 向下舍入,如Math.floor()

Math.round(x) 四舍五入,如Math.round(0.60),结果为1;Math.round(0.49),结果为0;
Math.floor(x) 向下舍入,如Math.floor(0.60)与Math.floor(0.49),结果均为0;
Math.ceil(x)向上舍入,如Math.ceil(0.60)与Math.ceil(0. 49),结果均为1。

猜你喜欢

转载自blog.csdn.net/jieweiwujie/article/details/126591352