Consider the following two 9bit floatingpoint representation
Consider the following two 9-bit floating-point representations based on the IEEE floating-point format. (a) Format A There is one sign bit There are k = 5 exponent bits. The exponent bias is 15. There are n = 3 frac bits. (b) Format B There is one sign bit. There are k = 4 exponent bits. The exponent bias is 7. There are n = 4 frac bits. Below, you are given some bit patterns in Format A. and your task is to convert them to the closest value in Format B. If rounding is necessary, you should round toward + infinity. In addition, give the values of numbers given by the Format A and Format B bit patterns. Give these as whole numbers (e.g., 17) or as fractions (e.g. 17/64 or 17/2^6.
Solution
-213 can alternatively be represented 1 1110 1111 but the number would be too far away from -2^13 so infinity is best suited.
| Foramt A | Format B | ||
| Bits | Value | Bits | Value |
| 1 01111 001 | -1.25 | 1 0111 0010 | -1.25 |
| 0 10110 011 | 176 | 0 1110 0011 | 176 |
| 1 00111 010 | -1.25/27 | 1 0000 0100 | -1.25/27 |
| 0 00000 111 | 7 | 0 0000 0111 | 7 |
| 1 11100 000 | -213 | 1 1111 1111 | - infinity |
| 0 10111 100 | 384 | 0 1111 1000 | 384 |
