登录站点

用户名

密码

yhzhu的instagram日志

yhzhu的主页 » TA的所有ins日志 » 查看ins日志

小数处理

已有 105 次阅读  2016-01-26 17:42   标签normal  color  style 

//进位

    float numberToRound;

    NSInteger result;

    float totalloc = self.specifArray.count / 2;

    result = (NSInteger)ceilf(totalloc);



result = (NSInteger)roundf(<#float#>) //输出  roundf(5.61) = 6;

     roundf(5.41) = 6;



result = (NSInteger)ceilf(<#float#>)  //输出  roundf(5.61) = 6;



result = (NSInteger)floor(<#double#>)  //输出  roundf(5.61) = 5;



分享 举报