Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Problem 2: Bit Twiddling Computers use a particular word size (measured in bits) for representing integers. In the mid-1970s have word sizes of 16
2.
Problem 2: Bit Twiddling Computers use a particular word size (measured in bits) for representing integers. In the mid-1970s have word sizes of 16 bits were common A. How many distinct values can be encoded in a 16-bit word? Answer: Even back in those days most computers used a 2's complement representation for integers. In 2's complement notation, one negates a number by complementing each bit in its representation (i.e changing 0's to 1's and vice versa) and adding 1. By convention, we write 2's complement integers with the most-significant bit (MSB) on the left and the least-significant bit (LSB) on the right. Also by convention, if the MSB is 1, the number is negative; otherwise it's non-negative B. Assume a 16-bit 2's complement representation when answering the following questions. What's the binary representation for 0? For the largest positive integer that can be represented? For the most negative integer? What are the decimal equivalent for the largest positive and most negative integers? What do you get if you negate the largest negative integer (give both the binary and decimal values)? Answers 0 (binary) Largest positive (binary) Most negative (binary) Largest positive (decimal) Most negative (decimal) 2's complement of most negative (binary) 2's complement of most negative (decimal) C. Since writing strings of 16 bits gets tedious, it's often convenient to use hexadecimal notation where a single digit in the range 0-9 or A-F is used to represent adjacent groups of 4 bits (starting from the right). Give the corresponding 4-digit hexadecimal encoding for each of the following numbers Answers 1. 2. 3 4 5 6 7. 8 : 2048 : 1023 : 11281 10 :-1073110 :00000100001001002 : -409510 D. At first blush "Complementing each bit and adding 1" doesn't seem like an obvious way to negate a number. However, it should appear "obvious" after the following exercise : Enter 960910 in binary : Complement each bit of the binary number above : Compute the sum of the two numbers : What is the decimal equivalent of this 2's complment sum
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started