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這種形式
float