HW5: Encoding Floats

Suppose you are working with a team designing a new 8-bit machine, and they want to use some kind of floating point number. Unfortunately, the design team has handed you the job of coming up with an encoding for these floating point numbers. The problem is there are constraints.

The worst one is that you can only have six bits for these numbers. You need to come up with some kind of floating point encoding. That means you can only store a total of 64 different codes representing that many unique floating point values. Furthermore, the range of values you need to deal with range from something around +3.0 to -3.0.

You decide to use a simple binary encoding, with the whole number part, and the fractional part encoded in simple binary form. The “binary point” assumed to be in a specified position (between two bits).

You decide to “split” your 6-bit container into three parts:

  • 1 bit for the sign
  • 2 bits for the mantissa.
  • 3 bits for the fractional part (simple binary)

Here, the “binary point” is assumed to be positioned between the mantissa part and the fractional part.

Build a Table of Values

Edit the file used to construct this assignment by clicking on the “Show Source” look and complete this table. If you do this right, it will format nicely on GitHub

Binary bFloat dFLoat Hex
000000 +00.000 +0.0 0x00
000001 +00.001 +0.? 0x01

(Add lines as needed to complete this table).


One of your encodings will not make any sense, we will record that value as NAN, meaning “Not a Number”

Submitting Your Work

As usual, this homework needs to show up in a folder in your project repository. Make sure you can see it in your web browser on GitHub