Computer systems

On most computer systems, sizeof(float) returns 4 and sizeof(double) returns 8. Suppose we wanted to implement a two-byte float. One scheme is to partition the 16 bits of two bytes as follows:

sign

exponent

fraction (n/210)

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

In this scheme, bit 15 is the sign bit, the five bits #14 through #10 encode an exponent, and the low ten bits #9 through #0 encode a fraction. We can implement the following three cases, depending on the value of the exponent: