If a number is negative are all the leading bits 1?
For example I tried converting -26 with 2's compliment and got 11100110 but my calculator converted as 1111100110
not all the leading bits. Only the MSB(most significant bit) has to be 1. you've used 8-bit number system. The calculator must be using 10-bit number systems. so in 8-bit system -26 is represented as 11100110 and in 10-bit system it is shown as 1111100110
So to convert from a lower bit to a higher bit, the leading bits of the higher bit are the same as the leading bit from the lower bit?
In the example to convert to 10 bit we added two 1 to the beginning because it was negative? if it had been positive we would have added two 0s to the beginning?
Yes. If the number is positive, then it is clear it should be padded with zeros on the left.
Suppose that we have an n-bit negative number, i.e.,
for some , and suppose we add k bits. Then if we pad them with ones, the resulting number is
.
Now,
,
so the numbers are the same.