imzyf / ios-swift-learning-notes

📝 iOS Swift Learning Notes - see Issues
MIT License
0 stars 0 forks source link

向下取整和向上取整函数 #97

Open imzyf opened 6 years ago

imzyf commented 6 years ago

主要就是这几个函数根据需要,用floor, ceil,或者round

ceil(x)返回不小于x的最小整数值(然后转换为double型)。

floor(x)返回不大于x的最大整数值。

round(x)返回x的四舍五入整数值。