9-bit floating point representations using IEEE fl

2019-02-28 03:06发布

问题:

I'm having some trouble with a problem I've run into dealing with floating points. I'm having a hard time moving from floating point representation to decimal values and also from format A of the representation to format B of the representation.

The problem:

Consider the following two 9-bit floating-point representations based on the IEEE floating-point format.

  • Format A

There is one sign bit. There are k = 5 exponent bits. The exponent bias is 15. There are n = 3 fraction bits.

  • Format B

There is one sign bit There are k = 4 exponent bits. The exponent bias is 7. There are n = 4 faction bits

The problem wants me to convert the floating point representation "0 10110 011" from Format A to Format B. It also wants to know the values for each format. Can anyone assist me with the procedure for both of these tasks. Or perhaps direct me to an informative website that would be able to show me. I've been searching for a while now and I'm having trouble finding any resources. Thanks!

-Matt

回答1:

010110011 in the 1-5-3 format is sign 0, biased exponent 101102, and encoded significand 011. The sign is +, the unbiased exponent is 22–15 = 7, and the significand is 1.0112 = 1.375. (We prefixed the encoded significand with “1.”) So the number represented is +27•1.375 = 176.

To encode 176 in the 1-4-4 format, take advantage of the fact that you already know it is +27•1.375. Thus, the sign is +, the unbiased exponent is 7, and the significand is 1.0112. This significand fits in four bits (so no rounding is needed); the encoded significand (removing the leading “1.”) is 0110. The unbiased exponent is 7, the bias is 7, so the biased exponent is 14 = 11102. So the bit fields are sign 0, exponent 1110, significand 0110, and all nine bits are 011100110.