简体   繁体   中英

Rounding up in VB.NET

How can I round 4.39 to 5 in VB.NET?

I tried:

Math.Round(4.39, 0)

But it displays 4.

Use Math.Ceiling in order to round a number to the closest, larger, integer value:

Math.Ceiling(4.39)

As explained in the MSDN link:

"Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM