iOS中的round/ceil/floorf函数略解
2016-05-24 12:00
447 查看
extern float ceilf(float);
extern double ceil(double);
extern long double ceill(long double);
extern float floorf(float);
extern double floor(double);
extern long double floorl(longdouble);
extern float roundf(float);
extern double round(double);
extern long double roundl(longdouble);
round:如果参数是小数,则求本身的四舍五入。
ceil:如果参数是小数,则求最小的整数但不小于本身.
floor:如果参数是小数,则求最大的整数但不大于本身.
Example:如何值是3.4的话,则
3.4 -- round 3.000000
-- ceil 4.000000
-- floor 3.00000
CGRectMake(floorf(self.view.bounds.size.width*0.5f - 39.f*0.5f),self.view.bounds.size.height -57, 39, 39)
其中floorf(self.view.bounds.size.width*0.5f -39.f*0.5f)返回值为
140.000000这种形式
转帖http://blog.csdn.net/u014624597/article/details/23868729
extern double ceil(double);
extern long double ceill(long double);
extern float floorf(float);
extern double floor(double);
extern long double floorl(longdouble);
extern float roundf(float);
extern double round(double);
extern long double roundl(longdouble);
round:如果参数是小数,则求本身的四舍五入。
ceil:如果参数是小数,则求最小的整数但不小于本身.
floor:如果参数是小数,则求最大的整数但不大于本身.
Example:如何值是3.4的话,则
3.4 -- round 3.000000
-- ceil 4.000000
-- floor 3.00000
CGRectMake(floorf(self.view.bounds.size.width*0.5f - 39.f*0.5f),self.view.bounds.size.height -57, 39, 39)
其中floorf(self.view.bounds.size.width*0.5f -39.f*0.5f)返回值为
140.000000这种形式
转帖http://blog.csdn.net/u014624597/article/details/23868729
相关文章推荐
- asp Fix、Int、Round、CInt函数使用说明
- JavaScript Math.ceil() 函数使用介绍
- Ajax获取页面被缓存的解决方法
- PHP四舍五入、取整、round函数使用示例
- sqlserver四舍五入使用round函数及cast和convert函数
- PHP中round()函数对浮点数进行四舍五入的方法
- php取整函数ceil,floo,round的用法及介绍
- C#使用round函数四舍五入的方法
- JavaScript中使用Math.floor()方法对数字取整
- JavaScript整除运算函数ceil和floor的区别分析
- JavaScript Math.ceil 方法(对数值向上取整)
- js中Math之random,round,ceil,floor的用法总结
- JavaScript里四舍五入函数round用法实例
- python通过floor函数舍弃小数位的方法
- python学之round()函数
- mysql插入随机日期
- php 数字格式化保留两位有效小数
- 向上/向下取整和四舍五入编程实现
- 自定义ImageView圆形图