Tue, 8 Oct 2013, 11:11



A student writes:

 
> Hi Dr. Patt/TAs,
> 
> Yesterday in the review section, we discussed a floating point data type
> question. For 32 bits, I know the representation is 1 bit for sign, 8 bits
> for range, and 23 bits for precision. Likewise, the 64 bit representation
> is 1 sign bit, 11 exponent bits, 52 fraction bits.
> 
> I was reading one of your earlier emails from Sept. 10th and you used a 10
> bit floating point data type: 1 sign bit, 4 exponent bits and 5 fraction
> bits. On the exam, if the floating point data type is NOT 32 or 64 bits,
> will you give us the number of exponent and fraction bits we must have? If
> not, is there a way to determine that for a 10 bit floating point you need
> 4 exponent bits and 5 fraction bits?
> 
> Thanks.
>
> <<name withheld to protect one wanting to know how many bits to allocate>>


The real answer is it depends on the values you wish to represent *exactly*.
(Exactly means "with no rounding.")

The 10 bit floating point data type could have 4 exponent bits and 5 fraction
bits or 3 exponent bits and 6 fraction bits or 2 exponent bits and 7 fraction
bits, etc.  More fraction bits means more precision for each value represented.
More exponent bits means a larger range of values (bigger and tinier) that can 
be represented.  So, like so many things in our field, the answer is: 
It depends.

For example, you recall our first example: 6 5/8.  It is 110.101, and
normalized, it is 1.10101 x 2^(2).  Can you represent this number exactly
with 3 fraction bits?  How about 4?

Good luck tomorrow.

Yale