Assignment 9 -- Binary Numbers

advertisement
Lab 9 – Binary Conversions and Arithmetic
Due: Wednesday, April 12th by 9:00 PM
Lab: 10 points
Assignment: 10 points
Dean Zeller
CS10051
Spring, 2006
Objective
The student will convert binary integers to decimal, decimal to binary, and perform
binary arithmetic (addition, subtraction, and multiplication).
Materials: Binary Calculator
You will need a calculator with binary number functionality. The Microsoft Windows calculator is
sufficient for this assignment. The purpose of the calculator is to check your work on the assignments.
It is still important for you to know the method behind the calculation, as calculators will not be allowed
on the exam.
Background: Binary Numbers
The binary number system is used by computers to do every calculation and decision within a
computer’s Central Processing Unit (CPU), and is also the system used for long and short term storage.
It is helpful as computer scientists to know this number system very well. In the next few weeks, you
will learn how circuits are designed to make calculations in this system.
Lab Notes (5 points)
Given below are five questions dealing with binary conversions and arithmetic. Solve the problems
using the diagram method shown in class. Word processing is not necessary, but you are being graded
on neatness.
Lab Report (5 points)
For each question below, choose one problem to demonstrate using a word processor and/or graphics
package. Diagram your answer as shown in class.
Assignment 9 – Floating Point Binary
Objective
The student will perform binary division, convert decimal fractions to floating point
binary, convert floating point binary to decimal, and measure the error of 8-bit precision
binary numbers.
Background: Floating Point Binary
This system of numbers is typically left out of computer architecture textbooks. Conceptually, floating
point binary is no more difficult than decimal, just with a different “behavior.”
Assignment Notes (5 points)
Given below are five questions dealing with floating point binary. Solve the problems using the
diagram method shown in class. Word processing is not necessary, but you are being graded on
neatness.
Assignment Report (5 points)
For each question below, choose one problem to demonstrate using a word processor. Diagram your
answer as shown in class.
Grading:
You will be graded on the following criteria:
Accuracy
Correctly diagramming the solutions.
Organization
Neatness and readability of the answers and diagrams
Extra Credit:
Extra credit will be given for any of the following:
 Create and solve your own problems.
 Use a word processor on all problems.
Lab 9 Questions
QUESTION 1 Convert the following binary numbers to decimal.
0001 1001
1111 1101
1101 0101
0011 1010
0010 1001 1000
1110 1110 1110
QUESTION 2 Convert the following decimal numbers to binary.
29
250
78
315
1000
2049
QUESTION 3 Perform the following binary addition. Check your work for correctness, and make note of
any addition overflow. (Diagramming not necessary for checking work.)
1010 1100
+ 100 1010
1010 1000
+ 101 0111
+
1000 1000 1010
11 1101 1100
1011 1011
+ 111 0010
1100 0000
+ 111 1111
1001 1100 1000
+ 1011 0100 0101
QUESTION 4 Perform the following binary subtraction. Check your work for correctness.
(Diagramming not necessary for checking work.)
1011 1011
– 100 1001
1010 1000
– 101 1111
-
1011 1010 1010
11 1101 1100
1011 0110
- 101 1001
1110 1011
- 1101 1110
1111 1100 1000
- 1011 1100 0101
QUESTION 5 Perform the following binary multiplication. Check your work for correctness.
(Diagramming not necessary for checking work.)
0000 1101

111
0010 1001

1 0101
0010 1011

1 1101
0001 1010

1101
0010 0010

1 0010
1010 0011

1 1111
Assignment 9 Questions
QUESTION 1
Perform the following binary integer division problems. Give a remainder for problems
that do not divide evenly.
110 110110
101 10101001
111 10011011
110 110110
110 110110
10 110110000
100 110110000
1000 110110000
10000 110110000
QUESTION 2
Convert the following fractions into binary. Continue until the binary number terminates
or repeats. All numbers will terminate or repeat within 10 bits, most are 3 to 5 bits.
1
1
1
1
3
1
1
3
3
3
/5
/7
/10
/20
/8
/14
/13
/16
/32
/64
3
3
61
5
6
/16
/32
/64
/16
/19
.2
.3
.7125 .796875 .00390625
QUESTION 3
Convert the following 8-bit precision floating point binary numbers into decimal.
0.0110 10002
0.1000 01002
0.1111 11112
0.0000 00112
0.0000 00012
0.1010 10102
0.1000 01002
0.0101 01002
QUESTION 4
Convert .0525 and .995 into floating point binary. Continue until the binary number
terminates or repeats. (Hint: you will probably need a whole page to do this problem.)
QUESTION 5
Give the 8-bit precision floating point binary representation for the following decimal
numbers. Convert your answer back into decimal and indicate the difference between the
two decimal values.
.53
.42
.10
.75
.73
.25
.99
.01
.51
.24
Download