大家好,又见面了,我是你们的朋友全栈君。
举例:Math.ceil(11.4)=12; Math.ceil(-11.6)=-11;
举例:Math.floor(11.7)=11;Math.floor(-11.2)=-12;
顾名思义,四舍五入后取整,其算法为Math.round(x+0.5),即原来的数字加上0.5后再想下取整即可。 举例:Math.round(11.5)=12; Math.round(-11.5)=-11;
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127778.html原文链接:https://javaforall.cn