0
$\begingroup$

I was reading this link.

Here I noticed that, in table titles "Float Values (b = bias)", in exponent column, entry for denormalized reals is $00..00$, but in value column, the entry is $-b+1$. Why is there $+1$? If we consider bias of $127$ for single precision format, shouldnt it be $0-127$ only? If its $-126$, then shouldnt the entry in the exponent column be $00..01$?

(The article seems to have taken from Stallings book specified in the references. Stallings book also says the same as above.)

$\endgroup$
2
$\begingroup$

Both an exponent field of 00000000 and 00000001 encode an exponent of -126, but with 00000000 there is no implicit leading 1 and with 00000001 there is. Consider going from 0x00800000 (smallest normal) to 0x007fffff (biggest denormal). For 0x00800000 the significand (including leading 1) is still 0x00800000 (a nice coincidence), for 0x007fffff is significand is just 0x007fffff. Since the exponent remains the same, these are just as adjacent as they seem (the distance between them is the lowest non-zero denormal).

If the exponent for denormals was -127, the denormals would only fill up to halfway between zero and the lowest normal, leaving a large gap between the highest denormal and the lowest normal.

$\endgroup$
  • $\begingroup$ help me understand. (1) You said "0x007fffff (biggest normal)". You must have meant "biggest denormal", right? (2) You said "For 0x00800000 the significand (including leading 1) is still 0x00800000 (a nice coincidence)". But I guess significand ,that is mantissa, is lower 23 bits, which here all 0s as can be seen here (continued...) $\endgroup$ – anir Jan 10 '18 at 7:47
  • $\begingroup$ (...continued) (3) You said "Since the exponent remains the same", but in 0x007fffff, exponent is 1 as can be seen here, removing bias gives $1-127 = -126$. In 0x00800000, exponent is 0 as can be seen here, which is $0-127=-127$, but is given as $-126$ only, in this table also which is precisely doubt. How they have made $0-127=-126$. (Also having other doubts, but I guess they will get cleared once I get above clarified) $\endgroup$ – anir Jan 10 '18 at 7:47
  • $\begingroup$ @anir I meant denormal there yes, fixed it. For normal numbers you must take into account that the significand has an implicit leading one. The exponent for denormals is a special case, the normal bias calculation is simply not applicable. $\endgroup$ – harold Jan 10 '18 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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