Determining the number of iterations needed to find the number of bits in an integer I'm trying to understand the complexity/number of iterations needed to determine the number of bits in an integer.
4 = 100  =  3 bits
3 = 011  =  2 bits
8 = 1000 =  4 bits

I skimmed through this article and it says: A positive integer n has b bits when 2^b-1 ≤ n ≤ 2^b – 1
But when you do the math for an integer 4, you get 2.32 ~= 2. What am I doing wrong?
The number of bits is always an integer, so you have to solve for that equation over the integers.  Thus, use $\lceil \lg (n+1) \rceil$.