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 others answer contain more "1" in binary format?


1 Answer 1


When you bitwise AND a number in this format with 7F800000 you get:

AND 01111111100000000000000000000000

  = 0EEEEEEEE00000000000000000000000

Everything gets set to 0 except the exponent. Yes, it is necessary for the correct answer to have 8 ones, but it is also necessary that they are in the correct positions. 00007F80 would not be correct because it would result in:

AND 00000000000000000111111110000000

  = 00000000000000000MMMMMMMM0000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.