87
Chat with our AI personalities
To find the 2s complement invert all the bits and add 1:
-85 = ...1111 1010 1011
→ its 2s complement:
...1111 1010 1011 → ...0000 0101 0100 + 1 = 101 0101
1
To get the 2s complement, change all 1 bits to 0s and all 0 bits to 1s, and add 1 to the result. So the 2s complement of the 8-bit binary number 10001011 is the binary integer 01110101. If you want that in decimal, then remember that each place value column is twice the value of the place value column to its right, and the rightmost place value column for an integer is 1. Thus 01110101 in decimal is 64 + 32 + 16 + 4 + 1 = 117 (And 10001011 as a signed 8-bit binary integer represents the decimal integer -117.)
If you mean: 4(2s-1) = 7s+12 then the value of s works out as 16
Using 4 bits the signed range of numbers is -8 to 7. When working with signed numbers one bit is the sign bit, thus with 4 bits this leaves 3 bits for the value. With 3 bits there are 8 possible values, which when using 2s complement have ranges: for non-negative numbers these are 0 to 7; for negative numbers these are -1 to -8. Thus the range for signed 4 bit numbers is -8 to 7.
The closest value is the actual value which is 85*25 = 2125. No other value can get closer.