vb.net:四舍五入到下一个整数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1910254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:40:59  来源:igfitidea点击:

vb.net: rounding to next whole number

.netvb.net

提问by l--''''''---------''''''''''''

if i have an integer a_variable = 1.1

如果我有一个整数 a_variable = 1.1

how do i round it up to 2?

我如何将其四舍五入到 2?

回答by xster

Math.Ceiling(a_variable)

Math.Ceiling(a_variable)

回答by BBlake

Assuming you mean a single/double, use math.ceiling to get the next highest whole number.

假设您的意思是单/双,请使用 math.ceiling 获得下一个最高的整数。