Problem set 2.

For problems 1 - 5, consider the floating point format consisting of 1-bit
sign, 4-bit characteristic, and 3-bit mantissa fields.  Mantissa will 
be in the form of a binary value < 1.


1. The largest decimal value that can be stored in this floating point 
format is:

0 1111 111

Sign 0 = +

Characteristic 1111 = 15 decimal. However, characters are biased (excess)
so that both numbers larger and smaller than 1 can be indicated. Since the
range is 0 - 15 unsigned, and we would like to represent values between 
-8 and +7, we bias the characteristic by 8. So to find the true power 
represented in the characteristic, we must subtract 8 from the stored value.
15 - 8 = 7 and 2^7 = 128

Mantissa 111 = .111 (remember mantissa is a binary value < 1. So mantissa 
is 1 * 2^-1 + 1 * 2^-2 + 1 * 2^-3 or .5 + .25 + .125 = .875

Representable value is .875 * 128 = 112.0

2. Convert the decimal value 7.50 into binary and normalize it. 

Convert to binary                  7.50 = 111.100b
Normalize to create a number < 1   .111100b * 2^3

3. How is decimal 7.50 stored in this format (defined above)


Bias(excess 8) the exponent        3 + 8 = 11d 
Convert the exponent to binary    11 = 1011 

So

Sign bit for +   = 0
Characteristic   = 1011
Mantissa (3 bit) = 111


4. The decimal 7.50 is stored in this format, then it is retrieved.
What is the decimal value retieved?

Note that the precission of this number is very limited.  If we were
to convert the number back.

Mantissa  * 2 ^ (Characteristic excess removed)   
.111b * 2^(11 - 8)  = 111b * 2^0 = 7 

5. The decimal -7.25 is stored in this format as:

7.25 = 111.01b  - convert to binary
.11101b * 2^3   - normalize
2^3 -> 3 + 8 = 1011b - bias exponent (excess 8)
Sign - = 1

1 1011 111b - Note that mantissa is truncated.
1101 1111b = DFh

6. Consider what is know as the "Single-Precision Floating-Point" 
(non-IEEE) format that has 1-bit Sign, 7-bit Characteristic, and a 24-bit 
Mantissa.  What is the largest value that can be stored in this format?

0 Sign +

1111111 Characteristic is biased 64, so 127 - 64 = 63

.111111111111111111111111 Mantissa

.111111111111111111111111b * 2^63 

(1 - 1/2^24) * 2^63