Floating point conversion work-sheet

Real to Floating point numbers.

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

Example of a conversion

Part 1 - Decimal to float conversion. Convert the following to a binary storage. Use the IEEE 754 floating point ordering (sign, biased exponent, mantissa).

The number of bits for exponent and significand are provided. Show your work.

  1. Convert integer portion to binary.
  2. Convert decimal portion to binary. Remember you only need n+1 significant bits. If the integer 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. 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 and convert to binary. Remember that all 0's and all 1's are reserved flags
  6. Assemble parts of number. Give in both binary and hexadecimal.

  7. Convert the number back from its binary IEEE style format. Show work.

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 sign flag field.
Row 2 of the table below contains the size of the exponent.
Row 3 contains the size of the significand.
Row 4 contains the number being converted to floating point representation.

Sign 1 1 1 1 1
Exponent 5 9 3 10 11
Significand 10 4 6 12 10
Number -4095 0.775625 1/3 (.333...) -299.87 Your Z-Id 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

Converion examples

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

a. 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. 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. 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.

Given a floating point number representation with an 8 bit exponent and a 9 bit significand :

a. 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. 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. 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.