将目标C中的下一个整数向上舍入? [英] Round a float up to the next integer in objective C?
本文介绍了将目标C中的下一个整数向上舍入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
1.1 - >如何在一个浮点上舍入到目标C中的下一个整数值? 2
2.3 - > 3
3.4 - > 4
3.5 - > 4
3.6 - > 4
1.0000000001 - > 2
解决方案
您需要天花板功能。像这样使用:
float roundedup = ceil(otherfloat);
How can I round a float up to the next integer value in objective C?
1.1 -> 2
2.3 -> 3
3.4 -> 4
3.5 -> 4
3.6 -> 4
1.0000000001 -> 2
解决方案
You want the ceiling function. Used like so:
float roundedup = ceil(otherfloat);
这篇关于将目标C中的下一个整数向上舍入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文