0

Why do we need regime bits in posit?

posit encoding:

enter image description here

YuiTo Cheng
  • 4,705
kevin998x
  • 123

1 Answers1

1

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.

Ross Millikan
  • 374,822
  • 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 ? – kevin998x Mar 30 '19 at 07: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 – Ross Millikan 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. – Ross Millikan Mar 30 '19 at 23:39
  • Wait, why "have to put a 1 before the usual exponent," ? – kevin998x Mar 31 '19 at 00: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. – Ross Millikan Mar 31 '19 at 00:59
  • I think you mean normalized mantissa in which the most significant bit of mantissa is 1 ? – kevin998x Mar 31 '19 at 01:24
  • So, it should be "put a 1 before the usual mantissa" ??? – kevin998x Mar 31 '19 at 01:39
  • No, we need to do something to indicate that you should consider eleven more bits for the exponent instead of four. It is convenient to put it at the front so the first bit you get tells you whether the exponent is four or eleven, but you could put it anywhere in the word. – Ross Millikan Mar 31 '19 at 03:55
  • "first bit you get tells you whether the exponent is four or eleven" <-- I think you are trying to formulate a way to indicate how many exponent bits to use. But I suppose the regime bits determine this, there is no need for this special first bit indication, I presume ? Please correct me if wrong – kevin998x Mar 31 '19 at 12:57
  • My first bit is the regime bit in my encoding. The article is using some more complicated encoding which I believe has a variable number of regime bits. – Ross Millikan Mar 31 '19 at 14:14
  • For https://code.fb.com/ai-research/floating-point-math/ , what exactly are alpha, beta, gamma ?

    See https://i.imgur.com/Po8deKK.png and https://i.imgur.com/T7zkUNg.png

    – kevin998x Apr 02 '19 at 01:17