Confusion in "mask bits"

130 Views Asked by At

This is the question:

By definition of the IEEE754 standard, 32-bit floating point numbers are represented as follows:

S (1 bit) E (8 bits) M (23 bits) S: Sign bit E: Exponent M: Mantissa

Which of the following is the correct “mask bits” in hexadecimal to be used for extracting only the exponent part of the above format?
Here, “mask bits” means a bit pattern which is logically ANDed withthe 32-bit floating point value.

a) 107FFFFF b) 7F800000 c) FF100000 d) FF800000

The given answer is b : 7F800000, but i have no idea why, can anyone give me an explanation, i'm greatly appreciated!

Is that because :

7F800000 = 0111 1111 1000 (8)

While other answers contain more "1" in binary format?

1

There are 1 best solutions below

0
On

a 32-bit floating point numbers is a sequence of 32 bits. According to the definitions, the bits are arranged as follows

[S][EEEEEEEE][MMMMMMMMMMMMMMMMMMMMMMM]

Thus, the mask we want is: [0][11111111][00000000000000000000000]

Now, we remove the grouping and turn it to hexadecimal...

0111 1111 1000 0000 0000 0000 0000 0000

which translates to (b).