2
$\begingroup$

According to this wikipedia article the maximum single precision is 7f7fffff. Can some explain me why it is (7f7fffff)16 and not (7fffffff)16?

(7f7fffff)16 = (0111 1111 0111 1111 1111 1111 1111 1111)2
(7fffffff)16 = (0111 1111 1111 1111 1111 1111 1111 1111)2

$\endgroup$

1 Answer 1

3
$\begingroup$

The second exponent is FF, which signals NaN according to Wikipedia, and so the highest exponent is only FE. This is verified by the following C code snippet:

unsigned int i = 0x7FFFFFFF;
float f = *(float*)&i;

If you print f you get nan.

$\endgroup$

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.