## Homework Assignment 6

One exercise, submit as "hw6".  Due 2:45pm before lecture 10/10/2007.

### Goals

This homework is intended to provide you with practice working with floating-point representations.

• P&H 3.2, 3.3, and 3.6

### Submission instructions

Submit your solution by creating a directory named hw6 that contains a file copied from template.txt. From within that directory, type submit hw6.  Note that we will be autograding this assignment (except for explanations of course) in the stye of the quizzes, and you should format your template.txt accordingly.

This is not a partnership assignment. Hand in your own work.

### Explanation

Consider two representations for six-bit positive floating-point values. One—we'll call it representation B (for binary)—is a radix-2 representation. It stores an exponent in two bits, represented in two's complement (not biased). It stores the normalized significand in four bits, using the hidden bit as in the IEEE floating-point representation, making 0 unrepresentable. Thus the value 2.5 (decimal) = 10.1 (binary) would be represented as

```	01 (1) 0100
```

and the value 7/8 (decimal) = 0.111 (binary) would be represented as

```	11 (1) 1100
```

The second representation—we'll call it representation Q (for quaternary)—is a radix-4 representation. Like representation B, it stores an exponent—but of 4, not 2—in two bits, represented in two's complement. It stores the significand in four bits, which is the same as having two base-4 digits, with the first base-4 digit being to the left of the quaternary point and the second base-4 digit being to the right of the quaternary point. There is no hidden bit. The significand is not necessarily normalized. 2.5 (decimal) thus is represented as

```	00 1010
```

since 2.5 (decimal) = 2.2 (quaternary) = 40 × (2 × 40 + 2 × 4-1).

7/8 (decimal) = 3 × 4-1 + 2 × 4-2 = 4-1 × (3 × 40 + 2 × 4-1), so it's represented as

```	11 1110
```

The decimal fraction 3/4, which in quaternary is 0.3, has two representations, since it's expressible either as 40 × 3/4 or 4-1 × 3:

```	11 1100
00 0011
```

#### Problem 1 (4 points)

Find a value representable in representation B and not in representation Q. Defend your answer.

#### Problem 2 (4 points)

Fill out the following table.