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$
1
  • $\begingroup$ Just as a historical note, as of 2008, IEEE-754 uses the term "subnormal number". $\endgroup$ – Pseudonym Dec 14 '19 at 13:30
3
$\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.


Normally the number line including denormals looks like this (if you had 2 bits of significand, so 4 numbers per binade): (source)

floats with denormals

You can see the denormals and the numbers in the first normalized binade are equally spaced, meaning they have the same exponent. What happens if the denormals had the exponent which their encoding seems to imply?

bad denormals

A gap appears.

$\endgroup$
6
  • $\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
  • $\begingroup$ very sorry harold to come back to old post...can you please explain a bit more: "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." Not able to imagine how half fills it $\endgroup$ – anir Dec 13 '19 at 14:52
  • $\begingroup$ @anir added some images. $\endgroup$ – harold Dec 14 '19 at 10:26

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.