标签:小数 1.5 java round color floor span style back
java中提供三种小数取整方式
ceil:天花板,向上quzheng
Math.ceil(11.5) = 12
Math.ceil(-11.5) = -11
floor:地,向下取整
Math.floor(11.5) = 11
Math.floor(-11.5) = -12
round:4舍5入
Math.round(x + 0.5),再向下取整
当 x = 11.5 时,Math.round(x + 0.5) = Math.round(12) = 12
当 x = -11.5时,Math.round(x + 0.5) = Math.round(-11) = -11
标签:小数 1.5 java round color floor span style back
原文地址:http://www.cnblogs.com/caidanhui/p/6227718.html