Skip to content

Conversation

@sigilante
Copy link
Collaborator

Type III universal numbers (unums) are divided into three classes:

  1. Posits, or precise real numbers (well, as real as floats anyway).
  2. Quires, or compensated auxiliary sums.
  3. Valids, or bounded intervals.

We represent these using Hoon auras at three bitwidths:

  • @rpb, @rph, @rps :: posits
  • @rqb, @rqh, @rqs :: quires
  • @rvb, @rvh, @rvs :: valids

The bitwidths are 8-bit Bytes, 16-bit Halfs, and 32-bit Singles.
While we square on quires and valids, the current implementation is
only for posits.

@sigilante
Copy link
Collaborator Author

UNIVERSAL NUMBERS (UNUMS)

Type III universal numbers (unums) are divided into three classes:

  1. Posits, or precise real numbers (well, as real as floats anyway).
  2. Quires, or compensated auxiliary sums.
  3. Valids, or bounded intervals.

We represent these using Hoon auras at three bitwidths:

The bitwidths are 8-bit Bytes, 16-bit Halfs, and 32-bit Singles.
While we square on quires and valids, the current implementation is
only for posits.

A posit has four fields:

  • Sign bit (1), 0 for positive, 1 for negative.
  • Regime bits (1--(ps-1)), unary run-length encoded.
    • Regime scale is 2^2^es, where es is the max exponent size.
  • Exponent bits (0--(ps-2)), fixed if available but can be truncated.
  • Fraction bits (the rest), remaining bits to total bitwidth.

While posits can be written in a general purpose form, we are interested
in standard posit8, posit16, and posit32 representations. For these, the
following conventions apply:

  • posit8: 8 bits total

    • Sign bit s (1)
    • Regime bits k (1--7), unary run-length encoded (one different to end)
    • Exponent bits e (0), fixed
    • Fraction bits f (the rest), remaining to total bitwidth (the rest)
  • posit16: 16 bits total

    • Sign bit s (1)
    • Regime bits k (1--15), unary run-length encoded (one different to end)
    • Exponent bits e (1), fixed (but may be occluded by a full regime)
    • Fraction bits f (the rest), remaining to total bitwidth (the rest)
  • posit32: 32 bits total

    • Sign bit s (1)
    • Regime bits k (1--31), unary run-length encoded (one different to end)
    • Exponent bits e (2), fixed (but may be occluded by a full regime)
    • Fraction bits f (the rest), remaining to total bitwidth (the rest)
  • Gustafson & Yonemoto (2017), "Beating Floating Point at its Own Game:
    Posit Arithmetic", Supercomputing Frontiers and Innovations. 4 (2).
    Publishing Center of South Ural State University, Chelyabinsk, Russia.
    http://www.johngustafson.net/pdfs/BeatingFloatingPoint.pdf

@sigilante
Copy link
Collaborator Author

sigilante commented Jul 9, 2025

Today's work shook out some bugs in documentation:

  • The official posit standard doesn't clarify that the regime is $2^{2^\text{es}}$ in terms of exponent size (it justs uses 4).
  • The Wikipedia page is incorrect on posit8 minimum and maximum sizes very likely because of this.
  • We are currently following Gustafson 2019, p. 3, regarding useed rather than the posit standard of 2022. This accords with softposit behavior.

Next steps:

  • Fill out posit16, posit32.
  • Fix regime/exponent scaling for those (clarify with posit standard folks).
  • Set up arithmetic.
  • Set up @r conversions.
  • Make 0p atom syntax and parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants