Assignment 2 - Floating point conversion

Due Friday 12 Sept. 2014 at start of class.

80 Points

Real to Floating point numbers. 50 points

The following are a series of conversions between real numbers and their floating point storage. On a seperate sheet of paper and hand written, show your work and the answer for each following problem.

For the sanity of your TA, do, at most, do one number per page side. Do all steps for a particular number on one page. You may use both sides of the paper. Label (1.a., 1.b., etc.) each step of the answer.

Example of a conversion

Part 1 - Decimal to float conversion. Convert the following to the binary IEE 754 style floating point representation (sign, biased exponent, mantissa). The number of bits for exponent and significand are provided. Show your work.

Steps. 1 point each step.

  1. Convert integer portion to binary.
  2. Convert decimal portion to binary. Remember you only need n+1 signficant bits. If the integar portion generates a 5 bit value and the significand is 10 bits of storage, the decimal math should be carried out to 6 digits.
  3. (2 points) Convert to scientific notation 1.xxxxxxx X 2^y
    Remember to carry calculations at least 1 digit past the size of the significand and then truncate rather than round. We are truncating because the software used to check answers truncates.
  4. Calculate bias offset based on size of exponent.
    Bias offset = 2^(number of bits -1) - 1
  5. Add the exponent from step c to bias offset. Remember that all 0's and all 1's are reserved flags
  6. Assemble parts to create a float with the specifed size format. Remember sign flag.
  7. (2 points) Convert the number back from its binary IEEE style format. Show work.
  8. Using initial value and the re-converted value and calculate any difference.

Each column in the following table states a value to convert to floating point representation and the particular size of the various parts of that floating point number.

Row 1 of the table below contains the size of the exponent.
Row 2 contains the size of the significand.
Row 3 contains the number being converted to floating point representation.

Sign 1 1 1 1 1
Exponent 5 9 3 10 11
Signficand 10 4 6 12 10
Number -4095 0.78125 1/3 (.333...) -299.87 Your zid with decimal between
the 3rd and 4th digits most
significant digits. ###.####

Part 2 - Minimum/Maximum Floating Representation. These may be expressed as powers of 2, e.g., 2^23 - 2^17

Given a floating point number representation with a 6 bit exponent and a 7 bit signficand :

a. (10 points) Give the maximum positive value that can be stored. Show binary representation of the float and all work converting back to a real value.

b. (10 points) Give the minimum positive normalized value that can be stored. Show binary representation of the float and all work converting back to a real value.

c. (10 points) Give the minimum positive denormalized value that can be stored. Show binary representation of the float and all work converting back to a real value.