# What is the purpose of regime bits in posit encoding?

Why do we need regime bits in posit?

posit encoding:

## 1 Answer

The key is the sentence about tapered accuracy. Standard floating point allocates a fixed number of bits to the exponent and the mantissa. Every float in range is represented with the same fractional accuracy. Back when floats were $$32$$ bits, one standard was one bit for the sign, eight bits for the exponent, and $$23$$ bits for the mantissa, so the fractional accuracy was about $$2^{-23}\approx 10^{-7}$$. For IEEE $$64$$ bit floats there are $$52$$ bits in the mantissa, so the fractional accuracy is about $$2^{-52} \approx 2\cdot 10^{-16}$$

Tapered accuracy is essentially data compression on the exponent. Exponents near zero are more common than those near the end of the range. You use short bit strings to represent small exponents at the price of longer strings to represent large exponents. That leaves more bits for the mantissa when the exponent is small and fewer when the exponent is large. The posit bits are one implementation of this compression, which the author is claiming can be (almost) as fast as standard floating point. If small exponents can be represented with only six bits instead of eleven, you have five more bits of accuracy in the mantissa when the exponent is in that range.

• I still do not understand how regime bits help to obtain different accuracy for small and large exponents respectively... So, number of regime bits depend on the exponent ? Mar 30 '19 at 7:50
• I didn't follow through how the bits are used. In standard $64$ bit floating point there are$1$ sign bit, $11$ exponent bits, and $52$ mantissa bits. That gives a fractional accuracy of about $2^{-52}$ throughout the range and a range of exponent of $\pm 1023$. We could define the exponent to have $0$ followed by four bits for exponents close to zero. This would handle exponents $\pm 7$ but would give $58$ mantissa bits, so the fractional accuracy in this range would be 2^{-58}$. When you are outside this range, if you want to maintain the overall range Mar 30 '19 at 23:38 • you would have to put a$1$before the usual exponent, so the accuracy would go down to$2^{-51}$. Is this a good trade? If most of your numbers are within a factor$2^7$of$1\$ it is good. They are using some more complicated encoding, but the idea will be the same. Mar 30 '19 at 23:39
• Wait, why "have to put a 1 before the usual exponent," ? Mar 31 '19 at 0:57
• We need to indicate somehow that the next eleven bits should be taken as the exponent, not just the next four. It is standard in encoding theory that if you make the codes for some messages shorter, others must become longer. Mar 31 '19 at 0:59