Question

Convert -128 to an eight-bit binary value. Convert 64 to an eight-bit binary value. How do...

Convert -128 to an eight-bit binary value.

Convert 64 to an eight-bit binary value.

How do we represent -1 with a sixteen-bit binary value?

Briefly explain what is meant by “sign extension” and why it’s necessary.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

To represent a number in binary form you should remember this table or 8-bit:-

128 64 32 16 8 4 2 1

if you want to convert a positive number into binary, start with left, which is the largest number that can be subtracted from the given number. and then mark that bit as one and move to right.

If we want to change 64 to binary, we start with left 129 is larger than 64 so we move to right and now 64 can be subtracted by 64 so we mar bit at 64 as 1, now the remaining number is zero therefore we mark all the other bit as 0. So the 8-bit  binary form of 64 is 01000000.

-128 to an eight-bit binary value

For representing a negative number in 8-bit binary, we use 2's complement. Start with positive value i.e. 128, 8-bit binary of 128 is  10000000, convert it to 1's complement i.e. invert each digit i.e. 01111111, now to form 2's complement add 1 to the binary number i.e. 01111111 + 1 = 1000000 this is the required answer i.e. -128 in decimal.

To represent -1 with a sixteen-bit binary, we first represent it in 8-bit binary i.e. 11111111(how? for that i suggest try following steps that we used for -128), and then use sign extension method to extend the most significant digit to the left i.e. 11111111 11111111.

Sign extension is the operation that a computer uses to increase number of bit of a binary number while preserving the numbers sign and value. There are two ways of sign extension one for unsigned number and other for signed number. For unsigned numbers we just append required number of zeros to the most significant bit for example a 8-bit number 01000100 when represented in 16-bit binary form using extension it can be represented as 00000000 01000100. For signed Numbers sign extension is done by extending most significant bit with same value as that of most significant of the original number for example 10000001 when represented in 16-bit binary form using sign extension can be written as 11111111 10000001 as the most significant bit of the original number was 1 so 11111111 is appended on Most significant bit side.

Hope it clears your doubt :)

Add a comment
Know the answer?
Add Answer to:
Convert -128 to an eight-bit binary value. Convert 64 to an eight-bit binary value. How do...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT