What is the best method to find the number of digits of a positive integer?
I have found this 3 basic methods:
conversion to string
There's always this method:
n = 1; if ( i >= 100000000 ) { n += 8; i /= 100000000; } if ( i >= 10000 ) { n += 4; i /= 10000; } if ( i >= 100 ) { n += 2; i /= 100; } if ( i >= 10 ) { n += 1; }