5

I've been reading about the IEEE 754 standard, but can't understand how or why they chose those exact number of bits for the exponent and mantissa. For example, why 8 bits for the exponent and not 7 or 9 for the single precision? Similarly, why 11 for the double precision? Is there a formula you can use to come to this number? Say you had to design a 16-bit floating point number system. How would you know how many bits to allocate to the exponent?

2
  • 2
    Consider this similar question and the answers over on the retrocomputing stack: Where did the free parameters of IEEE 754 come from?. (And the checkmarked answer over there, by phuclv, has links to yet more Q&A on SO for different aspects of the question.)
    – davidbak
    Oct 16, 2022 at 0:58
  • Opinion: sign == 1 obvious. sign + exponent + mantissa = 2^n with the exponent, mantissa width reflecting a compromise of current art with market leaders more heavily weighed. Recall computer floating point types had existed at least back to the 1950s - well before IEEE 754 (1985) The approximate exponent, mantissa distribution already had decades of history. Dec 6, 2022 at 10:38

2 Answers 2

1

Even if you don’t know what’s best, in the end you have to make decision. You’ll have e exponent bits and 32-e or 64-e mantissa bits. The number of exponent bits gives you a range, and the number of mantissa bits gives you precision. You have to decide and you have to trade range for precision.

For 32 bits, seven exponent bits wouldn’t give you even a bigger range than 64 bit integers. One benefit of floating point is a bigger range, so I’d want e >= 8. On the other hand, 24 bit mantissa is not really good for precision, so I wouldn’t want less. So 8/24 bits is quite reasonable.

For 64 bits, you could have 8/56, 9/55, 10/54, 11/53, 12/52, 13/51, 14/50 bits. You’d pick one where a majority of the people making decisions feel that neither smaller range and more precision nor bigger range and less precision are beneficial. So it seems a majority thought that values up to 10^160 is too restrictive even with some extra precision, and values up to 10^640 gain little to compensate for the loss of precision.

I’d have some experts judge all the combinations that I suggested, rate them from 1 to 10, and take what’s judged best.

There may be technical reasons. An adder will take longer if the number of mantissa bits is higher. But likely the time will make a jump. Maybe (as an example) 25 to 50 bits take the same time, but 24 bits is faster and 51 is slower. In that situation you’d much prefer a 24 bit to a 25 bit mantissa, and a 50 bit to a 51 bit mantissa. Same for multiplication and division.

So it’s a balancing act, and since you need to decide you judge all the possibilities and take what you think is best.

2

Reading the referenced article completely would have answered parts of your question already:

The width of the exponent field for a k-bit format is computed as w = round(4 log2(k)) − 13. The existing 64- and 128-bit formats follow this rule, but the 16- and 32-bit formats have more exponent bits (5 and 8 respectively) than this formula would provide (3 and 7 respectively).

As to why the exponent field is wider for the small formats, that's probably designed such that the available range is more useful, but it's also possible that the 32-bit format had been finalized before the exponent width formula was defined.

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.