5 comments

  • librasteve3 hours ago
    Having witnessed the acceleration and adoption of IEEE754 close up (Weitek in the 80s), it is easy to underestimate the level of hardware tuning tricks baked into and developed around that standard.<p>I have made a spreadsheet app in Rust with exact and fast arithmetic, centered on Apache Arrow and Polars, so Integer (i64) and Float (f64) are joined by Decimal[n] (.parquet Decimal38) and Fraction(num&#x2F;dec).<p>After considering some alternatives for Fraction, including BigRat and maybe interval arithmetic the current pick is symbolic handling of num&#x2F;dec stored as .parquet Strings. Why? Well the other three types are fast, so it seems OK to have a slow but sure “back stop”.<p>It works well for Googol ranges of arithmetic and knows that 1&#x2F;7+4&#x2F;7 is 5&#x2F;7. This seems good for teaching purposes and scratching the exactness itch.<p>Anyway, I’m open to adding Posit provided there’s a Rust crate (fast-posit.rs?) and a way to shoe horn them into parquet. Please raise an issue over at <a href="https:&#x2F;&#x2F;omasheet.org" rel="nofollow">https:&#x2F;&#x2F;omasheet.org</a> repo if this is of interest.
    • gregates3 hours ago
      Funny thing about spreadsheets is that, if you want to be Excel-compatible, IEEE 754 isn&#x27;t sufficient. Excel worries a lot about making floating point numbers feel like real numbers to non computer scientists, to the extent that it sacrifices precision to achieve the property that the digits you type might by truncated, but they&#x27;ll never be rounded to a non-zero digit. And many Excel features work on numbers as displayed, rather than the underlying bytes. Numeric identity isn&#x27;t bit-equivalence, in Excel (e.g., 0.3 == 0.1 + 0.2). And order isn&#x27;t even transitive, for some applications (like filters).<p>It&#x27;s very easy to make a spreadsheet that adds binary64 numbers faster than Excel.
      • Someone2 hours ago
        IEEE 754 isn&#x27;t sufficient. Excel worries a lot about making floating point numbers feel like real numbers to non computer scientists<p>William Kahan, father of IEEE 754, wrote about that: <a href="https:&#x2F;&#x2F;people.eecs.berkeley.edu&#x2F;~wkahan&#x2F;Mind1ess.pdf" rel="nofollow">https:&#x2F;&#x2F;people.eecs.berkeley.edu&#x2F;~wkahan&#x2F;Mind1ess.pdf</a><p>&gt; And many Excel features work on numbers as displayed, rather than the underlying bytes.<p>I think that’s a configuration flag
        • librasteve1 hour ago
          Very interesting, I am doing a review of the types right now so I will read that (and the fat document).
      • librasteve1 hour ago
        Yes. Some programming languages (raku) allow for 0.1+0.2==0.3 (in that case Rats [or FatRats] are the default for decimal literals). Since Omasheet is built on Polars, I use their Decimal38 type for decimals, but conscious that that does not make 0.1+0.2=0.3, there is also a Fraction type with quotient literals and exact math for rational numbers.<p>Unlike Excel, Omasheet is kind of aimed at folk who know and care about numeric types. It has 6 base numeric types Integer(1), Fraction(1&#x2F;1), Decimal(1.0), Float(1e0), Scientific(1e0(00)) and Complex(1+0i) to cover ℤ, ℚ, ℝ and ℂ conceptually [with basic uncertainty to handle CODATA 2022]. And, like Raku, operations between unlike operands go to the more infectious type - so sin(x) is always irrational (Float or Complex).<p>So this, necessarily, is a forced compromise between helping a wide number of math&#x2F; science&#x2F; data&#x2F; education centric users with a sensible set of strict types and having an eye to the Excel level of usability since in the main most users of a spreadsheet are just going to be chucking numbers in and expect it to work.<p>I started with Rust BigRat for Fraction, but I couldn&#x27;t work out a way to line it up with the .parquet file format. Since the goal was to cover all kinds of arithmetic examples including &quot;how many atoms in the universe&quot; and &quot;what is a Googol (100*100)&quot; as well as proper fractions and ℚ without rounding. This works fine atm with symbolic num&#x2F;den representation (stored as Parquet Struct of Strings. You need to cast into one of the other types to get the Polars engine speed of course, so this is mainly for extreme edge cases and purity.
    • andrepd2 hours ago
      I&#x27;m the maintainer of fast-posit. It is not &quot;feature complete&quot; in the sense that it doesn&#x27;t implement all those elementary functions prescribed by the standard, with 100% correct rounding (far beyond my powers :)). It does impl the four basic operations, sqrt, conversions between it and all fundamental Rust numeric types, comparisons, all quire operations (add, sub, dot product): everything correctly rounded, and tested exhaustively or with proptest. It also supports &quot;bounded-posits&quot; (one more parameter you tweak to make sure your type covers your expected domain accurately).<p>You&#x27;re welcome to give it a try! <a href="https:&#x2F;&#x2F;github.com&#x2F;andrepd&#x2F;posit-rust&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andrepd&#x2F;posit-rust&#x2F;</a><p>I&#x27;m not sure how relevant it is to you, since you require exact arithmetic! In fact I&#x27;m not sure how you even use floats at all.
      • librasteve1 hour ago
        thanks! I&#x27;ll take a look ... one of the scary&#x2F;fun things about LLM era development is we could just make a posit spreadsheet ... the question is &quot;why&quot; ;-)
  • augment_me5 hours ago
    The paper’s central hw claim that a posit processing unit requires less circuitry and achieves higher POPS&#x2F;W than an IEEE 754 FPU was empirically refuted by ASIC and FPGA implementations earlier this month.<p>Source: (<a href="https:&#x2F;&#x2F;www.researchgate.net&#x2F;publication&#x2F;417276683_Hardware_architectures_for_posit_arithmetic_evolution_trade-offs_and_artificial_intelligence" rel="nofollow">https:&#x2F;&#x2F;www.researchgate.net&#x2F;publication&#x2F;417276683_Hardware_...</a>)<p>TLDR; The leading 0 + dynamic length and the 512-bit accumulators for quires require hardware specifics like extra register per MAC and barrel shifters which take up about 30% of the total unit area.<p>Probably not impossible to get around but in no way a drop-in or currently better supported by HW.<p>---<p>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.
    • cycomanic4 hours ago
      I think you&#x27;re overstating the claims and results of both papers. I would not regard anything in the first paper regarding how as a central claim (especially considering they did not really investigate hw implementations) and the second paper does review the challenges of hw implementations and importantly the progress toward as dressing them. I don&#x27;t think it refutes the claim of the first paper that hw implementations could potentially be less complex, it simply shows that implementation is more significantly more difficult in reality (the quite being a significant part of the difficulties). I don&#x27;t think it makes a statement that posits are fundamentally more complex (again considering it&#x27;s a review it can&#x27;t really make such claim).
    • Lerc4 hours ago
      Is there any good walkthrough on how to multiply and add with posits without converting to an intermediate representation. I see the appeal of it as an encoding of numbers in bits, but the times I have looked at the process of working with them, they seemed either impenetrable or converted to a higher precision float did the operation and converted back.
      • andrepd2 hours ago
        If you mean a software implementation, I would daresay my impl is actually pretty readable :) <a href="https:&#x2F;&#x2F;github.com&#x2F;andrepd&#x2F;posit-rust&#x2F;blob&#x2F;main&#x2F;src&#x2F;posit&#x2F;ops&#x2F;add.rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;andrepd&#x2F;posit-rust&#x2F;blob&#x2F;main&#x2F;src&#x2F;posit&#x2F;op...</a>. It&#x27;s also the fastest I&#x27;m aware of (at least back when I was working on it).<p>You do pretty much always have to convert to an intermediate representation of &quot;mantissa + exponent&quot;. That is how IEEE754 impls work also. It is a bit more complex than IEEE to do so, because of the variable-length field, but surprisingly not too much so (count-leading-0 plus a couple of shifts and xors do the trick!) Less than 2ns on my machine :)
        • schiffern2 hours ago
          It&#x27;s effectively a &quot;slide rule&quot; numerical system so (to avoid intermediate representations) multiplication become addition and addition becomes softmax, right?
          • andrepd2 hours ago
            I&#x27;m not sure what you mean by &quot;slide rule&quot; or &quot;softmax&quot; in this context :p but both binary IEEE and posits are essentially encodings of numbers of the form `(fraction &#x2F; DENOMINATOR) * 2*exponent`, where `fraction` and `exponent` are integers and `DENOMINATOR` is fixed. The same general principles for implementing arithmetic operations apply for both.
            • schiffern1 hour ago
              Oh boy, this is a fun one. :)<p>Slide-rules are handy because they convert multiplication into addition. Or technically that&#x27;s what <i>logarithms</i> do, and slide-rules are a physical implementation of logarithms.<p>Recall the classic identity:<p>log(x * y) = log(x) + log(y)<p>Slide-rules have multiple rulers, <i>and some are marked in log scale</i>, which lets you multiply totally mechanically! By aligning the markings, you effectively add two lengths, which (when read back on the log tick marks) becomes multiplication.<p>If you perform the same algebra transform as above, you see that addition becomes (oddly, but more intuitive the more you think about it) the Softmax function.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Softmax_function" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Softmax_function</a><p>This is my first time seeing Posits, but (having had similar ideas loosely inspired by the Doom bit-hacks) I just assumed this was one of the main sales pitches for Posits!
    • yababa_y4 hours ago
      This was an observational study not a constructional necessity ablation study, its design cannot support the conclusion you drew from it. Furthermore the conclusion for the latest gens is that it IS competitive when fixed.
    • andrepd2 hours ago
      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 <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2603.01615" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2603.01615</a><p>&gt; 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.<p>I&#x27;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&#x27;t see what you are claiming exactly.
      • adrian_b1 hour ago
        &gt; I&#x27;m not sure what you mean by this<p>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.<p>In almost all scientific&#x2F;technical computing applications, constant relative error is what is desired, and it also enables a relatively simple analysis of the error propagation.<p>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.<p>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.<p>For some weird reason, posits want smaller errors around the origin, and this is paid by greater errors far from the origin.<p>Perhaps there are applications where this is useful, but in decades of experience with various applications of scientific&#x2F;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.<p>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&#x27;s constant, Boltzmann&#x27;s constant, Avogadro&#x27;s constant and so on, for which posits are useless.<p>Perhaps posits might be better than floating-point for ML&#x2F;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&#x2F;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.
  • larodi4 hours ago
    dunno why, but subconsciouslly this all weirdly reminds of what they do in RoPE and TurboQuant
    • chaboud3 hours ago
      That&#x27;s probably down to the two-axis rotational representation, though my understanding of posits is that a lot of the love comes from reflection operations positionally.
  • LoganDark5 hours ago
    Worth noting that while these may be smaller than equivalent floats for many values (and indeed, for some applications a 32-bit posit <i>could</i> replace a 64-bit double), they lose precision far more rapidly at larger values, they lack NaN and Infinity entirely, and saturation can silently create enormously incorrect results. Also, attempts at creating hardware implementations have found them far more difficult and bulky than for floats, partly because of all the variable-length shenanigans.<p>Still, it&#x27;s quite nice to see yet another option for representing magnitudes in programming. Given the right domain, these could show many benefits indeed.
  • 1homsi4 hours ago
    [dead]