First off, you're off on your powers of 2. 32 = 25.
Anyway, I followed you through the first two steps. Your last step doesn't make sense.
- Find the power-of-two range that brackets the number. You want a power-of-two range of the form [-2N, 2N - 1]. So, for -26, that would be -25 ≤ -26 ≤ 25 - 1. That corresponds to -32 ≤ -26 ≤ 31.
- Number of bits for the 2s complement representation will then simply be N plus 1. The "plus 1" accounts for the sign bit. For -26, that's 5 + 1 = 6.
So, for each of the numbers you gave: -26, -1, 10, -15, -4.
- -25 ≤ -26 ≤ 25 - 1 becomes -32 ≤ -26 ≤ 31, which gives 5 + 1 = 6.
- -20 ≤ -1 ≤ 20 - 1 becomes -1 ≤ -1 ≤ 0, which gives 0 + 1 = 1.
- -24 ≤ 10 ≤ 24 - 1 becomes -16 ≤ 10 ≤ 15, which gives 4 + 1 = 5.
- -24 ≤ -15 ≤ 24 - 1 becomes -16 ≤ -15 ≤ 15, which gives 4 + 1 = 5.
- -22 ≤ -4 ≤ 22 - 1 becomes -4 ≤ -4 ≤ 3, which gives 2 + 1 = 3.
Got it?
The -1
one is tricky...