2. Signed Integers Unsigned binary numbers work for natural numbers, but many calculations use negative numbers as well. To deal with this, a number of different methods have been used to represent signed numbers, but we will focus on two's complement, as it is the standard solution for representing signed integers. 2.1 Two's complement • Most significant bit has a negative value, all others are positive. So, the value of an n-digit -2 two's complement number can be written as: Σ2 2¹ di 2n-1 dn • Otherwise exactly the same as unsigned integers. i=0 - • A neat trick for flipping the sign of a two's complement number: flip all the bits (0 becomes 1, or 1 becomes 0) and then add 1 to the least significant bit. • Addition is exactly the same as with an unsigned number. 2.2 Exercises For questions 1-3, answer each one for the case of a two's complement number and an unsigned number, indicating if it cannot be answered with a specific representation. 1. (15 pts) What is the largest integer that can be represented with 8 bits? How many bits do you need to represent the largest integer + 1? 2. (15 pts) How much data can we store on a 4 K-Byte memory chip? 3. (10 pts) What is the range of decimals (presented with powers of 2) that 8-bit two's complement can represent? What is the range of decimals that 12-bit two's complement can represent? Please explain why. 3. Counting Bit strings can be used to represent more than just numbers. In fact, we use bit strings to represent everything inside a computer. And, because we don't want to be wasteful with bits it is important to remember that n bits can be used to represent 2n distinct numbers. For each of the following questions, answer with the minimum number of bits possible: 1. (10pts) If the only value a variable can take on is 32.16, how many bits are needed to represent it?
2. Signed Integers Unsigned binary numbers work for natural numbers, but many calculations use negative numbers as well. To deal with this, a number of different methods have been used to represent signed numbers, but we will focus on two's complement, as it is the standard solution for representing signed integers. 2.1 Two's complement • Most significant bit has a negative value, all others are positive. So, the value of an n-digit -2 two's complement number can be written as: Σ2 2¹ di 2n-1 dn • Otherwise exactly the same as unsigned integers. i=0 - • A neat trick for flipping the sign of a two's complement number: flip all the bits (0 becomes 1, or 1 becomes 0) and then add 1 to the least significant bit. • Addition is exactly the same as with an unsigned number. 2.2 Exercises For questions 1-3, answer each one for the case of a two's complement number and an unsigned number, indicating if it cannot be answered with a specific representation. 1. (15 pts) What is the largest integer that can be represented with 8 bits? How many bits do you need to represent the largest integer + 1? 2. (15 pts) How much data can we store on a 4 K-Byte memory chip? 3. (10 pts) What is the range of decimals (presented with powers of 2) that 8-bit two's complement can represent? What is the range of decimals that 12-bit two's complement can represent? Please explain why. 3. Counting Bit strings can be used to represent more than just numbers. In fact, we use bit strings to represent everything inside a computer. And, because we don't want to be wasteful with bits it is important to remember that n bits can be used to represent 2n distinct numbers. For each of the following questions, answer with the minimum number of bits possible: 1. (10pts) If the only value a variable can take on is 32.16, how many bits are needed to represent it?
Chapter8: Data And Network Communication Technology
Section: Chapter Questions
Problem 41VE
Related questions
Question

Transcribed Image Text:2. Signed Integers
Unsigned binary numbers work for natural numbers, but many calculations use negative
numbers as well. To deal with this, a number of different methods have been used to represent
signed numbers, but we will focus on two's complement, as it is the standard solution for
representing signed integers.
2.1 Two's complement
• Most significant bit has a negative value, all others are positive. So, the value of an n-digit
-2
two's complement number can be written as: Σ2 2¹ di 2n-1 dn
• Otherwise exactly the same as unsigned integers.
i=0
-
• A neat trick for flipping the sign of a two's complement number: flip all the bits (0 becomes 1,
or 1 becomes 0) and then add 1 to the least significant bit.
• Addition is exactly the same as with an unsigned number.
2.2 Exercises
For questions 1-3, answer each one for the case of a two's complement number and an
unsigned number, indicating if it cannot be answered with a specific representation.
1. (15 pts) What is the largest integer that can be represented with 8 bits? How many bits
do you need to represent the largest integer + 1?
2. (15 pts) How much data can we store on a 4 K-Byte memory chip?
3. (10 pts) What is the range of decimals (presented with powers of 2) that 8-bit two's
complement can represent? What is the range of decimals that 12-bit two's
complement can represent? Please explain why.
3. Counting
Bit strings can be used to represent more than just numbers. In fact, we use bit strings to
represent everything inside a computer. And, because we don't want to be wasteful with bits it
is important to remember that n bits can be used to represent 2n distinct numbers. For each of
the following questions, answer with the minimum number of bits possible:
1. (10pts) If the only value a variable can take on is 32.16, how many bits are needed to
represent it?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning