Let’s say I have a number 546821.

I want to output the nearest ‘hundred thousand’, i.e. 550000, or the nearest ‘point something’ million ( I don’t know what else to call it ), i.e 600000.

If there was a way to count the digits, say a hypothetical **countdigit()** function, then I could’ve done it.

countdigit(546821)=6, say A

power(10, (A-1)) = 100000, say B

ceiling(546821/B)=6, say C

C*B = 600000

Rounding off to the nearest hundred thousand would require A-2 in the second step, and a few changes thereafter.

So, is there a way to count the number of digits?

Or is there any other way to achieve what I want, nevertheless?