Math类中round、ceil 和 floor方法的功能

Math.round(x) 相当于 (int) Math.floor(x+0.5f)

floor 方法返回小于操作数的最大整数值,返回值类型为double

ceil 方法返回大于操作数的最小整数值,返回值类型为double

发布了58 篇原创文章 · 获赞 0 · 访问量 1012

猜你喜欢

转载自blog.csdn.net/Mason97/article/details/104317598