Homework 1
Numbering Systems and Data Types
Due: (in class) Tuesday, November 2 at 9am
Outcomes
After successfully completing this assignment, you will
be able to...
 convert numbers between the binary, hexadecimal, and decimal
numbering systems
 do simple arithmetic problems in binary and hexadecimal
 show how signed integers are represented in binary
 show how floating point numbers are represented in binary
Before Starting
Read Chapters 1 and 2 (Patt).
Format and Submission of Assignment
The solution for
this assignment must be submitted as hardcopy at the beginning
of class (9am)
on the due date. All papers must be stapled together, and your name and login
name must appear at the top of every sheet. Handwriting must be
legible  if we can't read it, the grade is zero (you may use a word processor
or an editor to write your solution if you wish; please turn in a printed
copy).
Show your work for each problem, and/or explain the steps you are taking to
arrive at the answer. Put a circle around your answer. If you just
give the answer to a problem, without explaining or showing the steps in
obtaining the answer, that problem will be marked incorrect.
Problems (each problem is worth 10 points)

Perform the following conversions on unsigned numbers.
 a).
0000 0001 0101 0101 binary to decimal
 b).
1111 1110 1101 0011 binary to hexadecimal (you don't have to show your work for this problem)
 c).
96FC hexadecimal to decimal
 d).
837 decimal to hexadecimal
 e).
306 decimal to binary

In the base 6 numbering system there are 6 digits: 0, 1, 2,
3, 4, 5.
Perform the following conversions on unsigned numbers. SHOW
YOUR WORK.
 a).
255 base 6 to decimal
 b).
997 decimal to base 6

Perform the following conversions. Assume 16bit words.
SHOW YOUR WORK.
 a).
Write 223 decimal as a hexadecimal number in signmagnitude form
 b).
Write 223 decimal as a hexadecimal number in one's complement form
 c).
Write 223 decimal as a hexadecimal number in two's complement form

An 8bit word contains the bit pattern 1101 0111. What decimal number
does this represent if the word is
 a). an unsigned number
 b). a signed number in two's complement form

To convert a floating point number from decimal to binary, the integer and
fractional parts
must be considered separately. In class, we saw how to convert the integer
portion by doing repeated divisions by 2. The fractional part involves
repeated multiplications by 2. At each step, the fractional part of the
decimal number is multiplied by 2. The digit to the left of the decimal
point in the product will be 0 or 1 and contributes to the binary
representation of the fraction, starting with the most significant bit. The
fractional part of the product is used as the multiplicand in the next step.
Continue until the product contains a fractional part equal to 0, for exact
representations.
EXAMPLE: Convert 4.625 decimal to binary
Integer portion: 4 decimal = 100 binary
Fractional portion:
0.625 x 2 = 1.25 ==> .1
0.25 x 2 = 0.5 ==> 0
0.5 x 2 = 1.0 ==> 1
fractional portion of product is zero, so stop
4.625 decimal = 100.101 binary
Note, however, that the process will not necessarily yield an exact
representation. Just as some fractions
cannot be represented exactly in the decimal numbering system (e.g. 1/3),
neither can some fractions be represented exactly in the binary numbering
system (e.g. 1/10). In cases that do not yield an exact result, continue
until you find a repeating fraction, or for twentythree binary places, whichever
comes first.
 a).
Convert 115.25 decimal to IEEE singleprecision format (see pp 37  40
in the textbook).
Give the results as 8 hexadecimal digits. SHOW YOUR WORK.
 b).
Convert 3ED00000 hex (which is in IEEE single
precision format) to a decimal floating point number. SHOW YOUR WORK.

Compute the sum of the following IEEE singleprecision floating point
numbers and express the result as a hexadecimal number. The numbers to
be added are given in hexadecimal: 41280000, 40700000. Do not convert the numbers to decimal first; rather, do all the arithmetic in binary. (Hint: the
exponents must be the same when you add two numbers in floating point
format, same as you would do if you added two numbers that were specified
using
scientific notation).

 a). Represent the values 15 and 14 as 8bit 1's complement integers.
Add the two binary representations. What is the binary result? What decimal
value does that 1's complement result represent?
 b). Represent the values 15 and 14 as 8bit signed magnitude integers.
Add the two binary representations. What is the binary result? What decimal
value does that signed magnitude result represent?
 c). Represent the values 15 and 14 as 8bit 2's complement integers.
Add the two binary representations. What is the binary result? What decimal
value does that 2's complement result represent?
 Perform the following additions on 16bit hexadecimal values
(the numbers are 2's complement numbers). Provide your answers
as 16bit hexadecimal values.
 a). x034A + x2FF6 (notice the addition of two positive values gives
a positive result)
 b). xFFD4 + xFFF1 (notice the addition of two negative values gives
a negative result)
 c). xB123 + xC777 (explain why the addition of two negative values
gives a positive result)

 a). Do problem 2.22 from the textbook.
 b). Do problem 2.24 from the textbook.

 a). Do problem 2.34 from the textbook.
 b). Do problem 2.54 from the textbook.