Floating point Flashcards

remember floating point

1
Q

Suppose we have a floating-point 8-bit number format for which the most significant bit is used for the sign, the next 3 bits are used for the exponent and the remaining 4 bits for the fraction.

Using the IEEE convention for normalized, de-normalized and special numbers, what is the floating-point value of bytes containing the hexadecimal numbers 0x0C, 0x35 and 0xF0?

A

Answer: V = 3/16

<4-bit frac->

0x0C
denormalized => exponent bits are all zero
0 000 1100

V = (-1)^s x M  x 2^E
Bias = 2^(k-1) -1  where k => # of exp bits [3]
E = 1 - Bias => 1-3 = [-2]
M = f = 3/4
s = 0
V = 1 x 3/4 x 1/4 
V = 3/16
0x35 = 0 011 0101 => normalized
0xF0 = 1 111 0000 = >  special (exp are all 1s)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Suppose we have a floating-point 8-bit number format for which the most significant bit is used for the sign, the next 3 bits are used for the exponent and the remaining 4 bits for the fraction.

Using the IEEE convention for normalized, de-normalized and special numbers, what is the floating-point value of bytes containing the hexadecimal numbers 0x0C, 0x35 and 0xF0?

A

Answer: 11/16

0x35
00110101 ==> 0 011 0101

normalized (exponent bits are not all zeros)
V = (-1)^s x M x 2^E

Bias = 2^(k-1)-1 = 3
E = e - Bias (3-3) = [0]
M = 1 -f [1 - (1/4 + 1/16) = [21/16]
V = 1 x 21/16  x 2^0
V =  21/16

0x0C ==> 0 000 1100 => denormalized
0xFO ==> 1 111 0000 => special

How well did you know this?
1
Not at all
2
3
4
5
Perfectly