简体   繁体   中英

Roundoff numbers

How to round off the number 1452.1589758654654654678798751268549874654657497 & 1452.8589758654654654678798751268549874654657497 to next nearest number. After roundoff I need that number to be 1453 (not 1452).

Math.Round(1452.1589758654654654678798751268549874654657497, 0) but this just round off to 1452.

if you're not clear what I'm asking please comment below.

  • Math.Ceiling will return an integer that is larger. (Towards + infinity)
  • Math.Floor will return an integer that is smaller. (Towards - infinity)
  • Math.Round will return an integer that is rounded (it's value will depend on how it is called).

If you want a number that is larger, use Math.Ceiling. MSDN has complete details on all 3 of the built in .net framework methods.

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