0

I need to create a function which rounds numbers like this:

33120->34000

21001->22000

here are no decimal points but if there exist a number other than 1 in the last 3 digits the 4th digit must be incremented and the last 3 digits should be set to 0.

i need something optimized, i don't want to traverse each digit of each number since i have over 800,000 number.

thanks in advance!

4

1 回答 1

6
var result =  Math.Ceiling((double) x/1000)*1000;
于 2013-04-25T09:11:57.547 回答