Hello people. I wanted to know if it is possible to solve this problem.

I have a range : - to

so if w = 4, I would have a range -8 to 7 [-8,-7,...,0,1...,7]

This represents the range for a signed integer in 2's complement form (most computers use this format). w indicates the number of bits needed for numbers in the range specified to be represented in binary.. So if w = 4, i'll have the range [-8,7] and the binary form of 4 is 0100.

The question is, given a number, say 4, can I find out the value of w?

i.e. number = - to .. find w

any help would be appreciated..