Unofficial Hacker News companion — get notified on comment replies, and more.

Beating Floating Point at Its Own Game: Posit Arithmetic [pdf] (opens external site)

101 points by xenophonf 3 days ago | www.johngustafson.net | 34 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (6)

  1. This is quite an old paper. Much progress has been made since! Check out this paper from this year, showing an extension of the posit format (a new parameter besides bit count and exponent-field size, namely regime-field max size) that improves the mathematical properties of posits _and_ enables better hw designs https://arxiv.org/abs/2603.01615

    > Also non-uniform relative error is a nightmare for any numerical formal verifier that are used by most frontier labs today to avoid numerical divergence during training.

    I'm not sure what you mean by this. Yes IEEE has 40+ years of study behind it so its numerical properties are very well understood, that much is obvious. But I don't see what you are claiming exactly.

    Replies (1)
    1. > I'm not sure what you mean by this

      The floating-point number format has not been chosen due to some historical accident, but because it is the only number format that combines fast computation with almost constant relative error over the domain of the represented numbers.

      In almost all scientific/technical computing applications, constant relative error is what is desired, and it also enables a relatively simple analysis of the error propagation.

      The non-constant relative error of the posits makes the analysis of the error propagation very difficult. Many applications need accurate estimations of the worst-case errors that can affect the results.

      For any number representation system where the relative error is not constant, decreasing the error in some part of the domain increases the error in other parts of the domain, because the number of values is the same, being determined by the number of bits.

      For some weird reason, posits want smaller errors around the origin, and this is paid by greater errors far from the origin.

      Perhaps there are applications where this is useful, but in decades of experience with various applications of scientific/engineering computing I never wanted this error behavior, but I always wanted the constant relative error provided by FP numbers, even very far from the origin, with few exceptions where constant absolute error was desired, which is provided by fixed-point numbers, not by posits.

      So for me, posits are a solution in search for a problem, because I do not see which professional would want such a thing. Tailors might work with feet and inches, so posits might be adequate for them, but fixed-point numbers are even better for them, being easier to use and having a lower absolute error. On the other hand, an electronics engineer works with picoseconds, femtofarads, nanoamperes, megavolts, terahertz, the elementary electric charge, Planck's constant, Boltzmann's constant, Avogadro's constant and so on, for which posits are useless.

      Perhaps posits might be better than floating-point for ML/AI applications, but I say this only because I do not know which properties of the numbers really matter in that application, unlike for scientific/engineering computations, where I know with certainty that posits are not suitable, by leading to greater computational errors, while having a chance to be faster only for small number formats, not for 64-bit or bigger numbers.

      Replies (2)
      1. I'm not a numerical analyst, but what I've seen from Gustafson is that he's been at this game for over a decade. His original proposal was 'unums', which were essentially interval arithmetic, and heavily pitched on the basis of not needing numerical analysis to be able to do the sort of scientific computing that motivated floating-point. His book introducing the concept is literally titled "The End of Error" (although it's missing the word 'Analysis'). Then there was a "debate" between Gustafson and Kahan over unums versus floating-point [1], which, to my eyes, both sides lost [2].

        Evidently, Gustafson felt he had to change tack because he seems to have dropped unums after that debate and changed entirely to posits. And in the change to posits, he seems to have dropped most of the actual benefits of unums he was touting, although he hasn't quite dropped some of the cultish language he uses around the concept. The main trick of posits is to achieve greater precision for numbers around ±1 and greater exponent range, but by brushing the trade-offs used to achieve that under the rug. Except there's not really any demand for greater exponent range, so the trade-offs really overwhelm the marginal benefit of higher precision for a very specific range of numbers.

        The new paper linked in the comment you replied to appears to acknowledge this, even in the AI tiny floating-point space, by basically fixing a maximum exponent range so that you have usable precision at higher exponents.

        [1] I'd say IEEE floating-point, but the principles that Gustafson is attacking are found in virtually all formats pre-IEEE 754, with the exception of NaNs.

        [2] The transcript is here, for the reader to decide for themselves: http://www.johngustafson.net/pdfs/DebateTranscription.pdf

        Replies (1)
        1. (I'm the other author on the posits paper) so the PLAN was to build posits out to "valids", which make each "valid" (number type) interval arithmetic a pair of posits. I'm not particularly convinced of the benefit of interval arithmetic (the complexity explodes dramatically) but it was sure fun to work on. I really wanted the number system to be used in ML applications. One interesting thing is that a lot of tricky ML nonlinearities are approximated using trivial bit-manipulation. However, it seems to not have caught on.

          https://github.com/interplanetary-robot/SigmoidNumbers/blob/...

      2. > but in decades of experience with various applications of scientific/engineering computing I never wanted this error behavior

        I mean this is kind of "intuitive" error behavior. At some point the bigness of something is more important than the exact number. However, for sci/eng applications where peoples lives depend on your error analysis maybe not so much. For a lot of applications you want higher resolution around 1 -- and really you should be normalizing back to 1 after operations in general. And yes, I kept pointing out that error analysis and propagation was going to be a bitch =D which is why I kept pushing away from applications where you care a LOT about errors and towards applications where you care less about errors (like ML inference)

        Replies (1)
        1. > For a lot of applications you want higher resolution around 1

          To a minor extent yes, but when your main choices are 24 and 53 bits of precision, and a b-posit<32,6,5> offers one extra bit of precision, it's not very notable. Or if you adjust it so the float wins on dynamic range then you can squeeze out a second extra bit of precision.