读书人

关于Math 种的 3个静态方法ceil,floor

发布时间: 2012-12-23 11:28:15 作者: rapoo

关于Math 类的 3个静态方法ceil,floor,round方法
关于Math 类的 3个静态方法ceil,floor,round方法
ceil 是取其附近的最大值
floor是取其附近的最小值
roud 是取该值的中间值与该值进行相加运算后除以2 然后再取其附近的值
例如:

Math.cel(11.2) =11Math.floor(11.2)=12Math.round(11.2)  (11.2+11.5)/2=11.25 其附近的值为11Maht.ceil(-11.2)=-11Math.floor(-11.2)=-12Math.round(-11.2)    (-11.2+-11.25)/2=-11.25 其附近的值为-11

读书人网 >编程

热点推荐