现在的位置: 首页 > 综合 > 正文

Math的枚举常量(up,down,ceil,round,floor,half_up,half_down,half_evenround)

2013年06月12日 ⁄ 综合 ⁄ 共 224字 ⁄ 字号 评论关闭

 

Math.ceil(x):向正无限大方向舍入的舍入模式,比x大的最小值

Math.ceil(8.3)=9.0
Math.ceil(-8.3)=-8.0

Math.floor(x):向负无限大方向舍入的舍入模式,比x小的最大值

Math.floor(-1.4)=-2.0
Math.floor(1.8)=1.0

Math.round(x):四舍五入

Math.round(-2.7)=-3
Math.round(-2.3)=-2
Math.round(4.3)=4

 

抱歉!评论已关闭.