Chapter 3 - Number Systems
Does the following four-bit two's complement represent a negative or a positive integer? 1001
negative
Can the "binary addition algorithm" be used with sign-magnitude representation? Try adding +16 with -24: 0001 0000 16 1001 1000 -24
1 0001 0000 16 1001 1000 -24 ----------------- 1010 1000 -40 (wrong!)
Perform the following addition: 0F4A 420B
1 11 1 1 0F4A → 0000 1111 0100 1010 420B → 0100 0010 0000 1011 ------------------- 0101 0001 0101 0101 → 0x5155
Add these numbers, represented in eight bits. Determine if overflow occurs. 0110 1100 1001 1111 -----------
1 1111 100 0110 1100 1001 1111 0000 1011 (overflow detected)
Compute the following sum using 8 bits: 0000 0001 1111 1111 ----------
1 1111 111 0000 0001 1₁₀ 1111 1111 255₁₀ ------------ ------ 0000 0000 00₁₀ The carry bit of 1 out of the high order column (leftmost) indicates an overflow.
Here is a number represented in base three. The expression on the right of = is in base ten. What should fill the blanks? 2013 = 2 × 3--- + 0 × 3--- + 1 × 3---
1 2 3
What is the name of this pattern of four bits, using the pattern naming scheme: 1010 ? Base 16 Base 10 Base 2 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111
A ― this is the name of the pattern the four bits make.
Which one of the following is done correctly? A. 0100 0110 0101 ---- 1011 B. 0100 0110 0101 ---- 1111 C. 0110 0110 0101 ---- 1111 D. 0101 0110 0101 ---- 1001
A. 0100 0110 0101 ---- 1011
A particular number is represented by 1010 1010 (binary representation). What is the number represented in base ten?
Adding up the "turned on" powers of two gives: 128 + 32 + 8 + 2 = 170₁₀
In the following one-bit wide addition, what are the result R and the carry, C? C0 0 1 -- R
C=0; R=1
In the following one-bit wide addition, what are the result R and the carry, C? C1 0 1 -- R
C=1; R=0
Which one of the following is done correctly? A. 0100 1110 1001 ---- 1001 B. 0000 1110 1001 ---- 0111 C. 0111 1110 1001 ---- 1001 D. 1000 1110 1001 ---- 0111
D. 1000 1110 1001 ---- 0111
What are some of the advantages of positional notation?
Does not need a symbol for zero, easy to learn
Change the representation of 1011₂ from base two to base ten.
19₁₀
Change the representation of 203 from base four to base ten.
19₁₀
What is the name of the binary pattern 0001 1010 0100 0100 1101 ?
1A44D
Perform the "binary addition algorithm" on the following 8-bit two's complement numbers. Is the result correct or not? 1011 1101 1110 0101
he result is correct. 11111 1 1 1011 1101 1110 0101 ------------ 1010 0010
Change the representation of this number from hexadecimal to octal (base 8): 0x1A4
hex binary groups of 4 0x1A4 = 0001 1010 0100 = binary ungrouped octal groups of 3 000110100100 = 000 110 100 100 = 0644₈
Change the representation of 101₂ from base two to base ten.
0
Perform the following additions: 1 0 1 --- 0 1 0 --- 1 1 0 ---
1 0 1 --- 10 0 1 0 --- 01 1 1 0 --- 10
Change the representation of A5 from base sixteen to base ten
165
With 8-bit sign-magnitude representation, what positive integers can be represented and what negative integers can be represented?
-127₁₀ ... 0 ... +127₁₀
Convert 247₁₀ to hexadecimal. Algorithm: Convert from base 10 to base B Representation place = 0; number = number to be converted while (number > 0 ) { digit[place] = number mod B ; number = number div B ; place = place + 1 ; }
number = 247 247 div 16 = 15 r 7 → digit[ 0 ] = 7 number = 15 15 div 16 = 0 r 15 → digit[ 1 ] = F ("15" is in base 10, "F" is the hex digit) Result: 247₁₀ = 0xF7
What is the two's complement of 0100 0111?
reflect add one 0100 0111 → 1011 1000 → 1011 1001 It is always a good idea to check your results: 11111 111 + 0100 0111 1011 1001 ------------- 0000 0000
Fill in the table. Each row shows two representations of the same integer. The column on the left represents it in base five, the column on the right represents it in base ten (except you have to fill in that column.) Base five Representation Base ten Representation 0 1 2 3 4 10 11 12
0 1 2 3 4 5 6 7
Compute the following. Give the answer in binary notation. 0 + 0 = ? 0 + 1 = ? 1 + 0 = ? 1 + 1 = ?
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10
What are the "digits" ordinarily used for base five?
0 1 2 3 4
add these unsigned numbers, represented in eight bits. Determine if overflow occurs. 0010 1100 0101 0101 ----------
0 1111 100 0010 1100 0101 0101 1000 0001 (No overflow)
Say that you are using unsigned binary to represent integers with 6 bits. What range of integers can be represented?
0 to 63
Find the 8-bit pattern that gives eight zero-bits when added to the bit pattern for 6₁₀. (Hint: start at the right column, figure out what the ? has to be in each column, and work your way left.) 0000 0110 = 6₁₀ ???? ???? = -6₁₀ ————————— ———— 0000 0000 0₁₀
0000 0110 = 6₁₀ 1111 1010 = -6₁₀ ————————— ———— 0000 0000 0₁₀
Subtract 0001 1011 from 0011 0001. Is the result correct or not?
0001 0110 (correct) The number to be subtracted is negated by the usual means (reflect the bits, add one): 0101 1100 → 1010 0111 Then the "binary addition algorithm" is used: 00100 111 0010 0101 = 37₁₀ 1010 0111 = -89₁₀ —————————-———— 1100 1100 -52₁₀
Perform the following addition: 1100 0101 ----
0001 with a carry out of the left column of 1
The bit pattern 0011 0010 represents 50₁₀. What bit pattern represents 100₁₀
0011 0010 = 50₁₀ ; so 0110 0100 = 100₁₀
Subtract 0111 1000 from 1011 0000 Is the result correct or not?
0011 1000 (incorrect) The integer to be subtracted is complemented... 0111 1000 → 1000 0111 + 1 → 1000 1000 ...then added to the other: 10000 000 1011 0000 = - 80₁₀ 1000 1000 = -120₁₀ ————————— ———— 0011 1000 +56₁₀ ???
Here is a two's complement representation of an integer: 1100 0111 What is the two's complement representation of the negation of the integer?
0011 1001
Say that there are two operands represented using the two's complement method: operand A = 0011 1010 operand B = 0110 1011 Which of the following uses of the binary addition algorithm shows the problem A - B?
0011 1010 1001 0101 ---------
Compute the following sum using 8 bits. Is there overflow? 1101 0010 0110 1101 ----------
0011 1111 11 1101 0010 210₁₀ 0110 1101 109₁₀ ---------- ------ 0011 1111 63₁₀ The carry bit of 1 indicates overflow.
Here is a number represented in base 16 notation: 5A3F. Write the number in unsigned binary notation.
0101 1010 0011 1111
Change the representation of 24 from base eight to base two
010110₂
What is 0110 (binary representation) in base ten?
0110 = 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20 = 0 + 4 + 2 + 0 = 6
Confirm that this addition is correct. (1) Check that the binary addition algorithm was performed correctly by checking the left column, then (2) translate the binary operands into decimal to fill the blanks in the right column, and then (3) verify that the decimal addition in the right column gives the same sum. 0110 = ___(base 10) 0111 = ___(base 10) ______ 1101 = ___(base 10) Hopefully, the binary result in the bottom row will represent the same integer as the decimal result in the bottom row.
0110 = 6 (base 10) 0111 = 7 (base 10) 1101 = 13 (base 10)
Write the unsigned binary number 000 101 110 in octal representation.
056
Convert 1033₁₀ to hex. The algorithm can be described as: Divide the number by the base. The remainder is the digit. The quotient becomes the number. Repeat. The digits come out right to left.
0x409 1033 div 16 = 64 r 9; digit[0] = 9 64 div 16 = 4 r 0; digit[1] = 0 4 div 16 = 0 r 4; digit[2] = 4
Fill in the blanks in the rules for base TWO positional notation: 1) The base is ___. 2) There are ___"digits": ___, ___, ___, ____, ___. 3) Positions correspond to integer powers of ___, starting with power ___ at the rightmost digit, and increasing right to left. 4) The digit placed at a position shows how many times that power of ___ included in the number.
1) The base is 2. 2) There are 2 "digits": 0, 1. 3) Positions correspond to integer powers of two, starting with power 0 at the rightmost digit, and increasing right to left. 4) The digit placed at a position shows how many times that power of two is included in the number.
Here are the rules for positional notation. Fill in the blanks to work with base five: 1) The base is ___. 2) There are ___"digits": ___, ___, ___, ____, ___. 3) Positions correspond to integer powers of ___, starting with power ___ at the rightmost digit, and increasing right to left. 4) The digit placed at a position shows how many times that power of ___ included in the number.
1) The base is five. 2) There are five "digits": 0,1, 2, 3, 4 . 3) Positions correspond to integer powers of five, starting with power 0 at the rightmost digit, and increasing right to left. 4) The digit placed at a position shows how many times that power of five is included in the number.
Do the following: 10 + 01 ---------
10 + 01 --------- 11
What is the binary equivalent of 4733 octal?
100 111 011 011
What is the base 7 representation of 10201₃ ?
100 div 7 = 14 r 2; 14 div 7 = 2 r 0; 2 div 7 = 0 r 2; So 10201₃ = 100ten = 202₇
Convert 100₁₀ to base 3.
100ten = 100 div 3 = 33 r 1; 33 div 3 = 11 r 0; 11 div 3 = 3 r 2; 3 div 3 = 1 r 0; 1 div 3 = 0 r 1 So 100ten = 10201₃ Checking: 10201₃ = 1 × 3^4 + 0 × 3^3 + 2 × 3^2 + 0 × 3^1 + 1 × 30 = 1 × 81 + 0 × 27 + 2 × 9 + 0 × 3 + 1 = 81 + 18 + 1 = 100
Here is an integer represented in base two: 1011. What is the representation in base two of the number times sixteen?
1011 0000. Appending four zeros multiplies the number being represented by 2^4.
Change the representation of 102 from base five to base ten.
102₅ = 1 × 5₁₀^2 + 0 × 5₁₀^1 + 2 × 5₁₀^0 = 25₁₀ + 2₁₀ = 27₁₀
Change the representation of 1010 from base two to base ten.
10₁₀
Here is a two's complement representation of an integer: 0011 1001 What is the two's complement representation of the negation of the integer?
1100 0111
Subtract 0101 1001 from 0010 0101 Is the result correct or not?
1100 1100 (correct) 11100 111 1110 0101 = -27₁₀ 1010 0111 = -89₁₀ ————————------ 1000 1100 -116₁₀
Represent 27₁₀ in base 2.
11011
Now try to compute the negative of 128ten. 128 = 1000 0000 reflect = ___ add one = ___
128 = 1000 0000 reflect = 0111 1111 add one = 1000 0000 ??????
Change the representation of 0000 1111 from base two to base ten.
15
Convert the representation of the following from base 16 to base 8: 0x37A.
1572
More practice: Whatis the integer (represented in base 10) that is represented by 1B2 (base sixteen) ? 1B2 = ___ × sixteen^2 + ___ × sixteen^1 + ___ × sixteen^0 1B2 = ___₁₀ × 16^2 + ___₁₀ × 16^1 + ___₁₀ × 16^0 1B2 = ___₁₀ × ___₁₀ + ___₁₀ × ___₁₀ + ___₁₀ × ___₁₀ 1B2 = ___10
1B2 = 1 × sixteen^2 + B × sixteen^1 + 2 × sixteen^0 1B2 = 1₁₀ × 16^2 + 11₁₀ × 16^1 + 2₁₀ × 16^0 1B2 = 1₁₀ × 256₁₀ + 11₁₀ × 16₁₀ + 2₁₀ ×1₁₀ 1B2 = 256₁₀ + 176₁₀ + 2₁₀ 1B2 = 434₁₀
How many integers are there in the range -128 ... 0 ... +127 ? How bit patterns can be formed with 8 bits?
256 256 Every pattern of the 256 patterns has been assigned an integer to represent.
Change the representation of 010100 from base two to base ten.
26₁₀
Write the unsigned binary number 0010 1110 in hexadecimal representation
2E
With 8 bits, there are 28 patterns. What is the largest positive integer that can be represented in 8 bits using base two?
2^8 - 1 = 256 - 1 = 255. There are 256 patterns possible with 8 bits. But when these patterns represent integers, One of the patterns (0000 0000) is used for zero.
Fill in the blanks with BASE SIXTEEN digits 31A (base sixteen) = ___ × sixteen^2 + ___ × sixteen^1 + ___ × sixteen^0
31A (base sixteen) = 3 × sixteen^2 + 1 × sixteen^1 + A × sixteen^0
The MIPS32 chip has 32-bit registers. What do you think is the usual size of the operands when binary addition is performed?
32 bits.
Change the representation of 100010 from base two to base ten.
34
Without doing any calculation, which of the following is the decimal equivalent of 1111 1111 1111? 2048 4095 16384 18432 Look at fact 3 in the list and think a bit. 3) (2^N - 1) is represented by 1....1....1 (all 1's).
4095 Hopefully you did something clever: you realized that the represented number is 2^N - 1 which must be an odd number. ( 2^N means 2 × 2 × 2 ... × 2 it must be even. So 2^N - 1 must be odd. )
Write the unsigned binary number 000 101 110 in decimal representation.
46
Change the representation of 10 from base two to base ten.
5
What is digit[ 0 ] = 54 mod 16 ? What is number = 54 div 16 ? Algorithm: Convert from base 10 to base B Representation place = 0; number = number to be converted while (number > 0 ) { digit[place] = number mod B ; number = number div B ; place = place + 1 ; }
54 = 16 × 3 with a remainder of 6. digit[ 0 ] = 54 mod 16 = 6, number = 54 div 16 = 3
Change the representation of 0011 1100 from base two to base ten.
60
What number goes in the empty cell of the table: Power of 2: 6 5 43 2 1 0 Decimal : ???? 32 168 4 2 1
64
Fill in the blanks with the appropriate power of 10: 7305 = 7 × 10___ + 3 × 10___ + 0 × 10___ + 5 × 10___
7305 = 7 × 10^3 + 3 × 10^2 + 0 × 10^1 + 5 × 10^0
Convert 304 from base 5 to base 10.
79
Change the representation of 24 from base eight to base ten.
7₁₀
Convert the following to base ten: 201₃
8
What is sixteen times 8B3 ?
8B30
A ___(base 16) = ___(base 10) = ___(base 2)
A (base 16) = 10 (base 10) = 1010 (base 2)
What is the decimal representation of this 8-bit two's complement integer: 1001 1111
First note that the "sign bit" is set, so the integer is negative. Then find the positive integer: 1001 1111 reflect → 0110 0000 add one → 0110 0001 convert to decimal → 26 +25 + 1 = 9710 put sign in front → -9710
Here is a correctly performed addition: 1100 0100 1110 ---- 0010 What is true about overflow for this addition?
If the operands are regarded as unsigned binary, then the result shows overflow. If the operands are regarded as two's complement binary, then the result shows no overflow.
Here is a correctly performed addition: 1000 1100 1010 ---- 0110 What is true about overflow for this addition?
If the operands are regarded as unsigned binary, then the result shows overflow. If the operands are regarded as two's complement binary, then the result shows overflow.
A number added to 14₁₀ results in a zero. What could that number be?
Might be -14.
A number added to one results in a zero. What could that number be?
Might be minus one.
Can 682₇ be rewritten in base ten notation?
No. It is a meaningless representation because the digit 8 can not be used with base seven.
Copy 1s from the bit pattern to the last row of the table, starting at the right. Compute the sum of the corresponding decimal numbers. Power of 2: 10 9 8 7 6 5 4 3 2 1 0 Decimal: 1024 512 256 128 64 32 16 8 4 2 1 Include?
Power of 2: 10 9 8 7 6 5 4 3 2 1 0 Decimal: 1024 512 256 128 64 32 16 8 4 2 1 Include?: 1 1 1 1 Sum = 64 + 32 + 8 + 1 = 105₁₀
Let us say that you need to represent an equal number of positive and negative integers in eight bits. How many negative numbers can represented? How many positive numbers?
Since there are 256 possible bit patterns with 8 bits, there could be 128 positive and 128 negative integers. You may have thought of the sign-magnitude method, discussed below.
Fill in the blanks: The positive integer: 0000 0110 ( 6₁₀ ) Reflect each bit: ___ Add one: ___ ( -6₁₀ )
The positive integer: 0000 0110 ( 6₁₀ ) Reflect each bit: 1111 1001 Add one: 1111 1010 ( -6₁₀ )
Can the binary addition algorithm be used with patterns that represent negative integers?
Yes. Subtracting an integer X from Y is the same as adding -X to Y.
What do you suppose is the decimal equivalent of 0111 1111 ?
You may have noticed that 0111 1111 is one less than 1000 0000, which is 128. So 0111 1111 represents of 127₁₀.
What are the "digits" of base two number representations usually called?
bits