# %pip install -U git+https://github.com/graphcore-research/gfloat airium
# %load_ext autoreload
# %autoreload 2

Making value tables

In this notebook, we generate value tables akin to those at P3109.

Thes tables comprise one-line summaries of each float value in the form

Code Binary     = Exact binary E =  Float16 equivalent Float16 binary E    = Float Value
0x21 0_0100_001 = +0b1.001*2^-4  = 0_01011_0010000000 +0b1.0010000000*2^-4 = ~0.0703
import math
from gfloat import *
from gfloat.formats import *
import numpy as np
from IPython.display import HTML
import airium

Define some helpers.

Render with underscores separating s_e_m

E.g 0_1011_110. For formats with zero significand bits or zero exponent bits, we use 0_1011110_ or 0__10111110.

def str_bits_with_underscores(fi, fv):
    signstr = f"{fv.signbit}_" if fi.is_signed else ""

    # 0_1011110_
    if fi.tSignificandBits == 0:
        return f"{signstr}{fv.exp:0{fi.expBits}b}_"

    # 0__1011110
    if fi.expBits == 0:
        return f"{signstr}{fv.significand:0{fi.tSignificandBits}b}"

    # 0_101_1110
    return f"{signstr}{fv.exp:0{fi.expBits}b}_{fv.significand:0{fi.tSignificandBits}b}"


fi = format_info_p3109(5, 3)
assert str_bits_with_underscores(fi, decode_float(fi, 0x09)) == "0_10_01"

fi = format_info_p3109(8, 1)
assert str_bits_with_underscores(fi, decode_float(fi, 0x41)) == "0_1000001_"

fi = format_info_p3109(8, 7)
assert str_bits_with_underscores(fi, decode_float(fi, 0x41)) == "0_1_000001"

Render a binary16 value

Returns two strings, like this:

'0_00010_1010000000', '+0b1.1010000000*2^-13'
import struct


def b16_str(val) -> tuple[str, str]:
    """
    Represent VAL in binary16.

    If val does not convert exactly to binary16,
    returns "<Not16:{val}>"
    """
    with np.errstate(over="ignore"):
        b16 = np.float16(val)

    if float(b16) != val and np.isfinite(b16):
        # Finite, but not representable in float16
        return f"<Not16:{val}>", ""
    b16_int = struct.unpack("!H", struct.pack("!e", b16))[0]

    # bitstr is of the form 0_00000_1100000000
    s = f"{b16_int:016b}"
    e_str = s[1:6]
    m_str = s[6:]
    bitstr = f"{s[0]}_{e_str}_{m_str}"

    # pow2str is of the form '+0b0.1100000000*2^-15', or '' for nonfinite values
    e = int(e_str, 2) - 15
    m = int(m_str, 2)
    leading_bit = 0 if e == -15 else 1
    signstr = "-" if s[0] == "1" else "+"
    if np.isfinite(b16):
        pow2str = f"{signstr}0b{leading_bit}.{m:010b}*2^{e}"
    else:
        pow2str = ""
    return bitstr, pow2str


assert b16_str(13 * 2**-16) == ("0_00010_1010000000", "+0b1.1010000000*2^-13")

Make HTML table

def mktbl(
    airium_in, fi: FormatInfo, cols=4, skip_rows=None, dark=True, short=False, **kw
):
    # Make tables
    nvals = 2**fi.bits
    rows = nvals // cols

    # dark = True  # Used @media selector in CSS, but it doesn't work inside vscode
    css = ""

    def value_style(fv):
        if fv.fclass == FloatClass.SUBNORMAL:
            return "color: #0df" if dark else "color: #02b"

        if not (
            fv.fclass == FloatClass.NORMAL
            or fv.fclass == FloatClass.ZERO
            and not fv.signbit
        ):
            return "color: #d80" if dark else "color: #952"

        return ""

    title = f"FP{fi.k} Value Table, {fi.name}"
    a = airium_in

    with a.table(klass="zmktbl"):
        for i in range(0, rows):
            if skip_rows and i in skip_rows:
                if i - 1 not in skip_rows:
                    with a.tr(klass="zmktbl"):
                        for x in range(cols):
                            a.td(klass="zmktbl", _t="...", style="text-align: center;")
                continue
            if i > 0 and i % 16 == 0:
                # blank row
                trstyle = "blankrow"
            else:
                trstyle = "datarow"
            with a.tr(klass="zmktbl " + trstyle):
                for n in range(i, nvals, rows):
                    fv = decode_float(fi, n)
                    h = hex(fi, fv)
                    b = str_bits_with_underscores(fi, fv)
                    b2 = binary_pow2(fi, fv)
                    v = float_tilde_unless_roundtrip_str(fv.fval, **kw)
                    if short:
                        text = v
                    else:
                        text = " = ".join([h, b, b2, v])
                    with a.td(klass="zmktbl", style="text-align: left;"):
                        a.pre(klass="zmktbl", _t=text, style=value_style(fv))
    css += """
    table.zmktbl {
        margin: 0pt;
        border-collapse: collapse; 
    }
    tr.zmktbl {
      margin: 0;
    }
    td.zmktbl {
      border: 1px solid;
    }
    pre.zmktbl {
      margin: 4pt 1pt 1pt 13pt; 
      display: inline;
      font-family: monospace;
      font-size: 16px;
      font-weight: bold;
    }
    """

    return css, a, title


import contextlib
from airium import Airium


def airdoc(css, html, title):
    a = Airium()
    a("<!DOCTYPE html>")
    a.style(_t=css)
    with a.html():
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t=title)
        with a.body():
            a.h3(_t=title)
            a.div(_t=html)

    return str(a)


skip_rows = set(range(5, 9)) | set(range(0x13, 0x1B))
ad = airdoc(*mktbl(Airium(), format_info_ocp_e3m2, cols=2, skip_rows=skip_rows))
with open("/tmp/aa.html", "w") as f:
    f.write(ad)
HTML(ad)
FP6 Value Table, ocp_e3m2

FP6 Value Table, ocp_e3m2

0x00 = 0_000_00 = 0.0 = 0.0
0x20 = 1_000_00 = -0.0 = -0.0
0x01 = 0_000_01 = +0b0.01*2^-2  = 0.0625
0x21 = 1_000_01 = -0b0.01*2^-2  = -0.0625
0x02 = 0_000_10 = +0b0.10*2^-2  = 0.125
0x22 = 1_000_10 = -0b0.10*2^-2  = -0.125
0x03 = 0_000_11 = +0b0.11*2^-2  = 0.1875
0x23 = 1_000_11 = -0b0.11*2^-2  = -0.1875
0x04 = 0_001_00 = +0b1.00*2^-2  = 0.25
0x24 = 1_001_00 = -0b1.00*2^-2  = -0.25
... ...
0x09 = 0_010_01 = +0b1.01*2^-1  = 0.625
0x29 = 1_010_01 = -0b1.01*2^-1  = -0.625
0x0a = 0_010_10 = +0b1.10*2^-1  = 0.75
0x2a = 1_010_10 = -0b1.10*2^-1  = -0.75
0x0b = 0_010_11 = +0b1.11*2^-1  = 0.875
0x2b = 1_010_11 = -0b1.11*2^-1  = -0.875
0x0c = 0_011_00 = +0b1.00*2^0   = 1.0
0x2c = 1_011_00 = -0b1.00*2^0   = -1.0
0x0d = 0_011_01 = +0b1.01*2^0   = 1.25
0x2d = 1_011_01 = -0b1.01*2^0   = -1.25
0x0e = 0_011_10 = +0b1.10*2^0   = 1.5
0x2e = 1_011_10 = -0b1.10*2^0   = -1.5
0x0f = 0_011_11 = +0b1.11*2^0   = 1.75
0x2f = 1_011_11 = -0b1.11*2^0   = -1.75
0x10 = 0_100_00 = +0b1.00*2^1   = 2.0
0x30 = 1_100_00 = -0b1.00*2^1   = -2.0
0x11 = 0_100_01 = +0b1.01*2^1   = 2.5
0x31 = 1_100_01 = -0b1.01*2^1   = -2.5
0x12 = 0_100_10 = +0b1.10*2^1   = 3.0
0x32 = 1_100_10 = -0b1.10*2^1   = -3.0
... ...
0x1b = 0_110_11 = +0b1.11*2^3   = 14.0
0x3b = 1_110_11 = -0b1.11*2^3   = -14.0
0x1c = 0_111_00 = +0b1.00*2^4   = 16.0
0x3c = 1_111_00 = -0b1.00*2^4   = -16.0
0x1d = 0_111_01 = +0b1.01*2^4   = 20.0
0x3d = 1_111_01 = -0b1.01*2^4   = -20.0
0x1e = 0_111_10 = +0b1.10*2^4   = 24.0
0x3e = 1_111_10 = -0b1.10*2^4   = -24.0
0x1f = 0_111_11 = +0b1.11*2^4   = 28.0
0x3f = 1_111_11 = -0b1.11*2^4   = -28.0

OCP E2M1

This is a 4-bit format, without Inf or NaN

HTML(airdoc(*mktbl(Airium(), format_info_ocp_e2m1, cols=1, width=8, d=3)))
FP4 Value Table, ocp_e2m1

FP4 Value Table, ocp_e2m1

0x00 = 0_00_0 = 0.0 = 0.0
0x01 = 0_00_1 = +0b0.1*2^0   = 0.5
0x02 = 0_01_0 = +0b1.0*2^0   = 1.0
0x03 = 0_01_1 = +0b1.1*2^0   = 1.5
0x04 = 0_10_0 = +0b1.0*2^1   = 2.0
0x05 = 0_10_1 = +0b1.1*2^1   = 3.0
0x06 = 0_11_0 = +0b1.0*2^2   = 4.0
0x07 = 0_11_1 = +0b1.1*2^2   = 6.0
0x08 = 1_00_0 = -0.0 = -0.0
0x09 = 1_00_1 = -0b0.1*2^0   = -0.5
0x0a = 1_01_0 = -0b1.0*2^0   = -1.0
0x0b = 1_01_1 = -0b1.1*2^0   = -1.5
0x0c = 1_10_0 = -0b1.0*2^1   = -2.0
0x0d = 1_10_1 = -0b1.1*2^1   = -3.0
0x0e = 1_11_0 = -0b1.0*2^2   = -4.0
0x0f = 1_11_1 = -0b1.1*2^2   = -6.0

A range of 4-bit formats

IEEE P3109 defines a range of 4-bit formats, varying precision, signedness, and domain. Here we generate four tables for each precision.

Some observations about the formats:

  • the p=1 formats are pure-exponent formats

  • the p=3 signed format is linear, but the p=3 unsigned format is floating

  • the p=4 unsigned format is linear, the p=4 signed format is identical to p=3

# Convert to PNG
import IPython


def render(fis, short=True):
    html = airdoc(*fourtables(fis, short=short, dark=False))
    display(HTML(html))


def fourtables(fis, **kw):
    a = airium.Airium()
    a("<!DOCTYPE html>")
    a.style(
        _t="""
        table {
          font-family: monospace;
          text-align: left;
          font-size: 1.3em;
        }
        .fourtables-td table {
          width: 100%;
        }
        td.zmktbl {
          border: 0px solid;
        }
        pre.zmktbl {
        }
        .fourtables-td tr:nth-child(odd) {
          background-color: #eee;
        }
        .fourtables-td tr:nth-child(even) {
          background-color: #ccc;
        }
        """
    )
    with a.div(style="width:1200px; background-color: #fff; color: black;"):
        with a.table(klass="fourtables-table"):
            for row in (0, 1):
                with a.tr(style="width:100%;"):
                    for fi in fis:
                        if row == 0:
                            a.th(klass="fourtables-th", _t=f"{fi}")
                        else:
                            with a.td(
                                klass="fourtables-td",
                                style="width:248px;",
                            ):
                                css, html, title = mktbl(
                                    a, fi, cols=1, width=8, d=4, **kw
                                )

    return css, str(a), ""


render([format_info_p3109(4, p) for p in range(1, 4)] + [format_info_ocp_e2m1])
render([format_info_p3109(4, p) for p in range(1, 4)], short=False)

p3109_k4p1se p3109_k4p2se p3109_k4p3se ocp_e2m1
0.0
0.125
0.25
0.5
1.0
2.0
4.0
inf
nan
-0.125
-0.25
-0.5
-1.0
-2.0
-4.0
-inf
0.0
0.25
0.5
0.75
1.0
1.5
2.0
inf
nan
-0.25
-0.5
-0.75
-1.0
-1.5
-2.0
-inf
0.0
0.25
0.5
0.75
1.0
1.25
1.5
inf
nan
-0.25
-0.5
-0.75
-1.0
-1.25
-1.5
-inf
0.0
0.5
1.0
1.5
2.0
3.0
4.0
6.0
-0.0
-0.5
-1.0
-1.5
-2.0
-3.0
-4.0
-6.0

p3109_k4p1se p3109_k4p2se p3109_k4p3se
0x00 = 0_000_ = 0.0 = 0.0
0x01 = 0_001_ = +0b1.0*2^-3  = 0.125
0x02 = 0_010_ = +0b1.0*2^-2  = 0.25
0x03 = 0_011_ = +0b1.0*2^-1  = 0.5
0x04 = 0_100_ = +0b1.0*2^0   = 1.0
0x05 = 0_101_ = +0b1.0*2^1   = 2.0
0x06 = 0_110_ = +0b1.0*2^2   = 4.0
0x07 = 0_111_ = inf = inf
0x08 = 1_000_ = nan = nan
0x09 = 1_001_ = -0b1.0*2^-3  = -0.125
0x0a = 1_010_ = -0b1.0*2^-2  = -0.25
0x0b = 1_011_ = -0b1.0*2^-1  = -0.5
0x0c = 1_100_ = -0b1.0*2^0   = -1.0
0x0d = 1_101_ = -0b1.0*2^1   = -2.0
0x0e = 1_110_ = -0b1.0*2^2   = -4.0
0x0f = 1_111_ = -inf = -inf
0x00 = 0_00_0 = 0.0 = 0.0
0x01 = 0_00_1 = +0b0.1*2^-1  = 0.25
0x02 = 0_01_0 = +0b1.0*2^-1  = 0.5
0x03 = 0_01_1 = +0b1.1*2^-1  = 0.75
0x04 = 0_10_0 = +0b1.0*2^0   = 1.0
0x05 = 0_10_1 = +0b1.1*2^0   = 1.5
0x06 = 0_11_0 = +0b1.0*2^1   = 2.0
0x07 = 0_11_1 = inf = inf
0x08 = 1_00_0 = nan = nan
0x09 = 1_00_1 = -0b0.1*2^-1  = -0.25
0x0a = 1_01_0 = -0b1.0*2^-1  = -0.5
0x0b = 1_01_1 = -0b1.1*2^-1  = -0.75
0x0c = 1_10_0 = -0b1.0*2^0   = -1.0
0x0d = 1_10_1 = -0b1.1*2^0   = -1.5
0x0e = 1_11_0 = -0b1.0*2^1   = -2.0
0x0f = 1_11_1 = -inf = -inf
0x00 = 0_0_00 = 0.0 = 0.0
0x01 = 0_0_01 = +0b0.01*2^0   = 0.25
0x02 = 0_0_10 = +0b0.10*2^0   = 0.5
0x03 = 0_0_11 = +0b0.11*2^0   = 0.75
0x04 = 0_1_00 = +0b1.00*2^0   = 1.0
0x05 = 0_1_01 = +0b1.01*2^0   = 1.25
0x06 = 0_1_10 = +0b1.10*2^0   = 1.5
0x07 = 0_1_11 = inf = inf
0x08 = 1_0_00 = nan = nan
0x09 = 1_0_01 = -0b0.01*2^0   = -0.25
0x0a = 1_0_10 = -0b0.10*2^0   = -0.5
0x0b = 1_0_11 = -0b0.11*2^0   = -0.75
0x0c = 1_1_00 = -0b1.00*2^0   = -1.0
0x0d = 1_1_01 = -0b1.01*2^0   = -1.25
0x0e = 1_1_10 = -0b1.10*2^0   = -1.5
0x0f = 1_1_11 = -inf = -inf
for p in (1, 2, 3, 4):
    fis = [
        format_info_p3109(4, p, signedness, domain)
        for signedness in (Signedness.Signed, Signedness.Unsigned)
        for domain in (Domain.Extended, Domain.Finite)
    ]
    render(fis, short=False)

p3109_k4p1se p3109_k4p1sf p3109_k4p1ue p3109_k4p1uf
0x00 = 0_000_ = 0.0 = 0.0
0x01 = 0_001_ = +0b1.0*2^-3  = 0.125
0x02 = 0_010_ = +0b1.0*2^-2  = 0.25
0x03 = 0_011_ = +0b1.0*2^-1  = 0.5
0x04 = 0_100_ = +0b1.0*2^0   = 1.0
0x05 = 0_101_ = +0b1.0*2^1   = 2.0
0x06 = 0_110_ = +0b1.0*2^2   = 4.0
0x07 = 0_111_ = inf = inf
0x08 = 1_000_ = nan = nan
0x09 = 1_001_ = -0b1.0*2^-3  = -0.125
0x0a = 1_010_ = -0b1.0*2^-2  = -0.25
0x0b = 1_011_ = -0b1.0*2^-1  = -0.5
0x0c = 1_100_ = -0b1.0*2^0   = -1.0
0x0d = 1_101_ = -0b1.0*2^1   = -2.0
0x0e = 1_110_ = -0b1.0*2^2   = -4.0
0x0f = 1_111_ = -inf = -inf
0x00 = 0_000_ = 0.0 = 0.0
0x01 = 0_001_ = +0b1.0*2^-3  = 0.125
0x02 = 0_010_ = +0b1.0*2^-2  = 0.25
0x03 = 0_011_ = +0b1.0*2^-1  = 0.5
0x04 = 0_100_ = +0b1.0*2^0   = 1.0
0x05 = 0_101_ = +0b1.0*2^1   = 2.0
0x06 = 0_110_ = +0b1.0*2^2   = 4.0
0x07 = 0_111_ = +0b1.0*2^3   = 8.0
0x08 = 1_000_ = nan = nan
0x09 = 1_001_ = -0b1.0*2^-3  = -0.125
0x0a = 1_010_ = -0b1.0*2^-2  = -0.25
0x0b = 1_011_ = -0b1.0*2^-1  = -0.5
0x0c = 1_100_ = -0b1.0*2^0   = -1.0
0x0d = 1_101_ = -0b1.0*2^1   = -2.0
0x0e = 1_110_ = -0b1.0*2^2   = -4.0
0x0f = 1_111_ = -0b1.0*2^3   = -8.0
0x00 = 0000_ = 0.0 = 0.0
0x01 = 0001_ = +0b1.0*2^-7  = ~0.0078
0x02 = 0010_ = +0b1.0*2^-6  = 0.015625
0x03 = 0011_ = +0b1.0*2^-5  = 0.03125
0x04 = 0100_ = +0b1.0*2^-4  = 0.0625
0x05 = 0101_ = +0b1.0*2^-3  = 0.125
0x06 = 0110_ = +0b1.0*2^-2  = 0.25
0x07 = 0111_ = +0b1.0*2^-1  = 0.5
0x08 = 1000_ = +0b1.0*2^0   = 1.0
0x09 = 1001_ = +0b1.0*2^1   = 2.0
0x0a = 1010_ = +0b1.0*2^2   = 4.0
0x0b = 1011_ = +0b1.0*2^3   = 8.0
0x0c = 1100_ = +0b1.0*2^4   = 16.0
0x0d = 1101_ = +0b1.0*2^5   = 32.0
0x0e = 1110_ = inf = inf
0x0f = 1111_ = nan = nan
0x00 = 0000_ = 0.0 = 0.0
0x01 = 0001_ = +0b1.0*2^-7  = ~0.0078
0x02 = 0010_ = +0b1.0*2^-6  = 0.015625
0x03 = 0011_ = +0b1.0*2^-5  = 0.03125
0x04 = 0100_ = +0b1.0*2^-4  = 0.0625
0x05 = 0101_ = +0b1.0*2^-3  = 0.125
0x06 = 0110_ = +0b1.0*2^-2  = 0.25
0x07 = 0111_ = +0b1.0*2^-1  = 0.5
0x08 = 1000_ = +0b1.0*2^0   = 1.0
0x09 = 1001_ = +0b1.0*2^1   = 2.0
0x0a = 1010_ = +0b1.0*2^2   = 4.0
0x0b = 1011_ = +0b1.0*2^3   = 8.0
0x0c = 1100_ = +0b1.0*2^4   = 16.0
0x0d = 1101_ = +0b1.0*2^5   = 32.0
0x0e = 1110_ = +0b1.0*2^6   = 64.0
0x0f = 1111_ = nan = nan

p3109_k4p2se p3109_k4p2sf p3109_k4p2ue p3109_k4p2uf
0x00 = 0_00_0 = 0.0 = 0.0
0x01 = 0_00_1 = +0b0.1*2^-1  = 0.25
0x02 = 0_01_0 = +0b1.0*2^-1  = 0.5
0x03 = 0_01_1 = +0b1.1*2^-1  = 0.75
0x04 = 0_10_0 = +0b1.0*2^0   = 1.0
0x05 = 0_10_1 = +0b1.1*2^0   = 1.5
0x06 = 0_11_0 = +0b1.0*2^1   = 2.0
0x07 = 0_11_1 = inf = inf
0x08 = 1_00_0 = nan = nan
0x09 = 1_00_1 = -0b0.1*2^-1  = -0.25
0x0a = 1_01_0 = -0b1.0*2^-1  = -0.5
0x0b = 1_01_1 = -0b1.1*2^-1  = -0.75
0x0c = 1_10_0 = -0b1.0*2^0   = -1.0
0x0d = 1_10_1 = -0b1.1*2^0   = -1.5
0x0e = 1_11_0 = -0b1.0*2^1   = -2.0
0x0f = 1_11_1 = -inf = -inf
0x00 = 0_00_0 = 0.0 = 0.0
0x01 = 0_00_1 = +0b0.1*2^-1  = 0.25
0x02 = 0_01_0 = +0b1.0*2^-1  = 0.5
0x03 = 0_01_1 = +0b1.1*2^-1  = 0.75
0x04 = 0_10_0 = +0b1.0*2^0   = 1.0
0x05 = 0_10_1 = +0b1.1*2^0   = 1.5
0x06 = 0_11_0 = +0b1.0*2^1   = 2.0
0x07 = 0_11_1 = +0b1.1*2^1   = 3.0
0x08 = 1_00_0 = nan = nan
0x09 = 1_00_1 = -0b0.1*2^-1  = -0.25
0x0a = 1_01_0 = -0b1.0*2^-1  = -0.5
0x0b = 1_01_1 = -0b1.1*2^-1  = -0.75
0x0c = 1_10_0 = -0b1.0*2^0   = -1.0
0x0d = 1_10_1 = -0b1.1*2^0   = -1.5
0x0e = 1_11_0 = -0b1.0*2^1   = -2.0
0x0f = 1_11_1 = -0b1.1*2^1   = -3.0
0x00 = 000_0 = 0.0 = 0.0
0x01 = 000_1 = +0b0.1*2^-3  = 0.0625
0x02 = 001_0 = +0b1.0*2^-3  = 0.125
0x03 = 001_1 = +0b1.1*2^-3  = 0.1875
0x04 = 010_0 = +0b1.0*2^-2  = 0.25
0x05 = 010_1 = +0b1.1*2^-2  = 0.375
0x06 = 011_0 = +0b1.0*2^-1  = 0.5
0x07 = 011_1 = +0b1.1*2^-1  = 0.75
0x08 = 100_0 = +0b1.0*2^0   = 1.0
0x09 = 100_1 = +0b1.1*2^0   = 1.5
0x0a = 101_0 = +0b1.0*2^1   = 2.0
0x0b = 101_1 = +0b1.1*2^1   = 3.0
0x0c = 110_0 = +0b1.0*2^2   = 4.0
0x0d = 110_1 = +0b1.1*2^2   = 6.0
0x0e = 111_0 = inf = inf
0x0f = 111_1 = nan = nan
0x00 = 000_0 = 0.0 = 0.0
0x01 = 000_1 = +0b0.1*2^-3  = 0.0625
0x02 = 001_0 = +0b1.0*2^-3  = 0.125
0x03 = 001_1 = +0b1.1*2^-3  = 0.1875
0x04 = 010_0 = +0b1.0*2^-2  = 0.25
0x05 = 010_1 = +0b1.1*2^-2  = 0.375
0x06 = 011_0 = +0b1.0*2^-1  = 0.5
0x07 = 011_1 = +0b1.1*2^-1  = 0.75
0x08 = 100_0 = +0b1.0*2^0   = 1.0
0x09 = 100_1 = +0b1.1*2^0   = 1.5
0x0a = 101_0 = +0b1.0*2^1   = 2.0
0x0b = 101_1 = +0b1.1*2^1   = 3.0
0x0c = 110_0 = +0b1.0*2^2   = 4.0
0x0d = 110_1 = +0b1.1*2^2   = 6.0
0x0e = 111_0 = +0b1.0*2^3   = 8.0
0x0f = 111_1 = nan = nan

p3109_k4p3se p3109_k4p3sf p3109_k4p3ue p3109_k4p3uf
0x00 = 0_0_00 = 0.0 = 0.0
0x01 = 0_0_01 = +0b0.01*2^0   = 0.25
0x02 = 0_0_10 = +0b0.10*2^0   = 0.5
0x03 = 0_0_11 = +0b0.11*2^0   = 0.75
0x04 = 0_1_00 = +0b1.00*2^0   = 1.0
0x05 = 0_1_01 = +0b1.01*2^0   = 1.25
0x06 = 0_1_10 = +0b1.10*2^0   = 1.5
0x07 = 0_1_11 = inf = inf
0x08 = 1_0_00 = nan = nan
0x09 = 1_0_01 = -0b0.01*2^0   = -0.25
0x0a = 1_0_10 = -0b0.10*2^0   = -0.5
0x0b = 1_0_11 = -0b0.11*2^0   = -0.75
0x0c = 1_1_00 = -0b1.00*2^0   = -1.0
0x0d = 1_1_01 = -0b1.01*2^0   = -1.25
0x0e = 1_1_10 = -0b1.10*2^0   = -1.5
0x0f = 1_1_11 = -inf = -inf
0x00 = 0_0_00 = 0.0 = 0.0
0x01 = 0_0_01 = +0b0.01*2^0   = 0.25
0x02 = 0_0_10 = +0b0.10*2^0   = 0.5
0x03 = 0_0_11 = +0b0.11*2^0   = 0.75
0x04 = 0_1_00 = +0b1.00*2^0   = 1.0
0x05 = 0_1_01 = +0b1.01*2^0   = 1.25
0x06 = 0_1_10 = +0b1.10*2^0   = 1.5
0x07 = 0_1_11 = +0b1.11*2^0   = 1.75
0x08 = 1_0_00 = nan = nan
0x09 = 1_0_01 = -0b0.01*2^0   = -0.25
0x0a = 1_0_10 = -0b0.10*2^0   = -0.5
0x0b = 1_0_11 = -0b0.11*2^0   = -0.75
0x0c = 1_1_00 = -0b1.00*2^0   = -1.0
0x0d = 1_1_01 = -0b1.01*2^0   = -1.25
0x0e = 1_1_10 = -0b1.10*2^0   = -1.5
0x0f = 1_1_11 = -0b1.11*2^0   = -1.75
0x00 = 00_00 = 0.0 = 0.0
0x01 = 00_01 = +0b0.01*2^-1  = 0.125
0x02 = 00_10 = +0b0.10*2^-1  = 0.25
0x03 = 00_11 = +0b0.11*2^-1  = 0.375
0x04 = 01_00 = +0b1.00*2^-1  = 0.5
0x05 = 01_01 = +0b1.01*2^-1  = 0.625
0x06 = 01_10 = +0b1.10*2^-1  = 0.75
0x07 = 01_11 = +0b1.11*2^-1  = 0.875
0x08 = 10_00 = +0b1.00*2^0   = 1.0
0x09 = 10_01 = +0b1.01*2^0   = 1.25
0x0a = 10_10 = +0b1.10*2^0   = 1.5
0x0b = 10_11 = +0b1.11*2^0   = 1.75
0x0c = 11_00 = +0b1.00*2^1   = 2.0
0x0d = 11_01 = +0b1.01*2^1   = 2.5
0x0e = 11_10 = inf = inf
0x0f = 11_11 = nan = nan
0x00 = 00_00 = 0.0 = 0.0
0x01 = 00_01 = +0b0.01*2^-1  = 0.125
0x02 = 00_10 = +0b0.10*2^-1  = 0.25
0x03 = 00_11 = +0b0.11*2^-1  = 0.375
0x04 = 01_00 = +0b1.00*2^-1  = 0.5
0x05 = 01_01 = +0b1.01*2^-1  = 0.625
0x06 = 01_10 = +0b1.10*2^-1  = 0.75
0x07 = 01_11 = +0b1.11*2^-1  = 0.875
0x08 = 10_00 = +0b1.00*2^0   = 1.0
0x09 = 10_01 = +0b1.01*2^0   = 1.25
0x0a = 10_10 = +0b1.10*2^0   = 1.5
0x0b = 10_11 = +0b1.11*2^0   = 1.75
0x0c = 11_00 = +0b1.00*2^1   = 2.0
0x0d = 11_01 = +0b1.01*2^1   = 2.5
0x0e = 11_10 = +0b1.10*2^1   = 3.0
0x0f = 11_11 = nan = nan

p3109_k4p4se p3109_k4p4sf p3109_k4p4ue p3109_k4p4uf
0x00 = 0_000 = 0.0 = 0.0
0x01 = 0_001 = +0b0.001*2^1   = 0.25
0x02 = 0_010 = +0b0.010*2^1   = 0.5
0x03 = 0_011 = +0b0.011*2^1   = 0.75
0x04 = 0_100 = +0b0.100*2^1   = 1.0
0x05 = 0_101 = +0b0.101*2^1   = 1.25
0x06 = 0_110 = +0b0.110*2^1   = 1.5
0x07 = 0_111 = inf = inf
0x08 = 1_000 = nan = nan
0x09 = 1_001 = -0b0.001*2^1   = -0.25
0x0a = 1_010 = -0b0.010*2^1   = -0.5
0x0b = 1_011 = -0b0.011*2^1   = -0.75
0x0c = 1_100 = -0b0.100*2^1   = -1.0
0x0d = 1_101 = -0b0.101*2^1   = -1.25
0x0e = 1_110 = -0b0.110*2^1   = -1.5
0x0f = 1_111 = -inf = -inf
0x00 = 0_000 = 0.0 = 0.0
0x01 = 0_001 = +0b0.001*2^1   = 0.25
0x02 = 0_010 = +0b0.010*2^1   = 0.5
0x03 = 0_011 = +0b0.011*2^1   = 0.75
0x04 = 0_100 = +0b0.100*2^1   = 1.0
0x05 = 0_101 = +0b0.101*2^1   = 1.25
0x06 = 0_110 = +0b0.110*2^1   = 1.5
0x07 = 0_111 = +0b0.111*2^1   = 1.75
0x08 = 1_000 = nan = nan
0x09 = 1_001 = -0b0.001*2^1   = -0.25
0x0a = 1_010 = -0b0.010*2^1   = -0.5
0x0b = 1_011 = -0b0.011*2^1   = -0.75
0x0c = 1_100 = -0b0.100*2^1   = -1.0
0x0d = 1_101 = -0b0.101*2^1   = -1.25
0x0e = 1_110 = -0b0.110*2^1   = -1.5
0x0f = 1_111 = -0b0.111*2^1   = -1.75
0x00 = 0_000 = 0.0 = 0.0
0x01 = 0_001 = +0b0.001*2^0   = 0.125
0x02 = 0_010 = +0b0.010*2^0   = 0.25
0x03 = 0_011 = +0b0.011*2^0   = 0.375
0x04 = 0_100 = +0b0.100*2^0   = 0.5
0x05 = 0_101 = +0b0.101*2^0   = 0.625
0x06 = 0_110 = +0b0.110*2^0   = 0.75
0x07 = 0_111 = +0b0.111*2^0   = 0.875
0x08 = 1_000 = +0b1.000*2^0   = 1.0
0x09 = 1_001 = +0b1.001*2^0   = 1.125
0x0a = 1_010 = +0b1.010*2^0   = 1.25
0x0b = 1_011 = +0b1.011*2^0   = 1.375
0x0c = 1_100 = +0b1.100*2^0   = 1.5
0x0d = 1_101 = +0b1.101*2^0   = 1.625
0x0e = 1_110 = inf = inf
0x0f = 1_111 = nan = nan
0x00 = 0_000 = 0.0 = 0.0
0x01 = 0_001 = +0b0.001*2^0   = 0.125
0x02 = 0_010 = +0b0.010*2^0   = 0.25
0x03 = 0_011 = +0b0.011*2^0   = 0.375
0x04 = 0_100 = +0b0.100*2^0   = 0.5
0x05 = 0_101 = +0b0.101*2^0   = 0.625
0x06 = 0_110 = +0b0.110*2^0   = 0.75
0x07 = 0_111 = +0b0.111*2^0   = 0.875
0x08 = 1_000 = +0b1.000*2^0   = 1.0
0x09 = 1_001 = +0b1.001*2^0   = 1.125
0x0a = 1_010 = +0b1.010*2^0   = 1.25
0x0b = 1_011 = +0b1.011*2^0   = 1.375
0x0c = 1_100 = +0b1.100*2^0   = 1.5
0x0d = 1_101 = +0b1.101*2^0   = 1.625
0x0e = 1_110 = +0b1.110*2^0   = 1.75
0x0f = 1_111 = nan = nan

Check k=5

for p in (1, 2, 3, 4, 5):
    fis = [
        format_info_p3109(5, p, signedness, domain)
        for signedness in (Signedness.Signed, Signedness.Unsigned)
        for domain in (Domain.Extended, Domain.Finite)
    ]
    render(fis, short=False)

p3109_k5p1se p3109_k5p1sf p3109_k5p1ue p3109_k5p1uf
0x00 = 0_0000_ = 0.0 = 0.0
0x01 = 0_0001_ = +0b1.0*2^-7  = ~0.0078
0x02 = 0_0010_ = +0b1.0*2^-6  = 0.015625
0x03 = 0_0011_ = +0b1.0*2^-5  = 0.03125
0x04 = 0_0100_ = +0b1.0*2^-4  = 0.0625
0x05 = 0_0101_ = +0b1.0*2^-3  = 0.125
0x06 = 0_0110_ = +0b1.0*2^-2  = 0.25
0x07 = 0_0111_ = +0b1.0*2^-1  = 0.5
0x08 = 0_1000_ = +0b1.0*2^0   = 1.0
0x09 = 0_1001_ = +0b1.0*2^1   = 2.0
0x0a = 0_1010_ = +0b1.0*2^2   = 4.0
0x0b = 0_1011_ = +0b1.0*2^3   = 8.0
0x0c = 0_1100_ = +0b1.0*2^4   = 16.0
0x0d = 0_1101_ = +0b1.0*2^5   = 32.0
0x0e = 0_1110_ = +0b1.0*2^6   = 64.0
0x0f = 0_1111_ = inf = inf
0x10 = 1_0000_ = nan = nan
0x11 = 1_0001_ = -0b1.0*2^-7  = ~-0.0078
0x12 = 1_0010_ = -0b1.0*2^-6  = ~-0.0156
0x13 = 1_0011_ = -0b1.0*2^-5  = -0.03125
0x14 = 1_0100_ = -0b1.0*2^-4  = -0.0625
0x15 = 1_0101_ = -0b1.0*2^-3  = -0.125
0x16 = 1_0110_ = -0b1.0*2^-2  = -0.25
0x17 = 1_0111_ = -0b1.0*2^-1  = -0.5
0x18 = 1_1000_ = -0b1.0*2^0   = -1.0
0x19 = 1_1001_ = -0b1.0*2^1   = -2.0
0x1a = 1_1010_ = -0b1.0*2^2   = -4.0
0x1b = 1_1011_ = -0b1.0*2^3   = -8.0
0x1c = 1_1100_ = -0b1.0*2^4   = -16.0
0x1d = 1_1101_ = -0b1.0*2^5   = -32.0
0x1e = 1_1110_ = -0b1.0*2^6   = -64.0
0x1f = 1_1111_ = -inf = -inf
0x00 = 0_0000_ = 0.0 = 0.0
0x01 = 0_0001_ = +0b1.0*2^-7  = ~0.0078
0x02 = 0_0010_ = +0b1.0*2^-6  = 0.015625
0x03 = 0_0011_ = +0b1.0*2^-5  = 0.03125
0x04 = 0_0100_ = +0b1.0*2^-4  = 0.0625
0x05 = 0_0101_ = +0b1.0*2^-3  = 0.125
0x06 = 0_0110_ = +0b1.0*2^-2  = 0.25
0x07 = 0_0111_ = +0b1.0*2^-1  = 0.5
0x08 = 0_1000_ = +0b1.0*2^0   = 1.0
0x09 = 0_1001_ = +0b1.0*2^1   = 2.0
0x0a = 0_1010_ = +0b1.0*2^2   = 4.0
0x0b = 0_1011_ = +0b1.0*2^3   = 8.0
0x0c = 0_1100_ = +0b1.0*2^4   = 16.0
0x0d = 0_1101_ = +0b1.0*2^5   = 32.0
0x0e = 0_1110_ = +0b1.0*2^6   = 64.0
0x0f = 0_1111_ = +0b1.0*2^7   = 128.0
0x10 = 1_0000_ = nan = nan
0x11 = 1_0001_ = -0b1.0*2^-7  = ~-0.0078
0x12 = 1_0010_ = -0b1.0*2^-6  = ~-0.0156
0x13 = 1_0011_ = -0b1.0*2^-5  = -0.03125
0x14 = 1_0100_ = -0b1.0*2^-4  = -0.0625
0x15 = 1_0101_ = -0b1.0*2^-3  = -0.125
0x16 = 1_0110_ = -0b1.0*2^-2  = -0.25
0x17 = 1_0111_ = -0b1.0*2^-1  = -0.5
0x18 = 1_1000_ = -0b1.0*2^0   = -1.0
0x19 = 1_1001_ = -0b1.0*2^1   = -2.0
0x1a = 1_1010_ = -0b1.0*2^2   = -4.0
0x1b = 1_1011_ = -0b1.0*2^3   = -8.0
0x1c = 1_1100_ = -0b1.0*2^4   = -16.0
0x1d = 1_1101_ = -0b1.0*2^5   = -32.0
0x1e = 1_1110_ = -0b1.0*2^6   = -64.0
0x1f = 1_1111_ = -0b1.0*2^7   = -128.0
0x00 = 00000_ = 0.0 = 0.0
0x01 = 00001_ = +0b1.0*2^-15 = ~3.052e-05
0x02 = 00010_ = +0b1.0*2^-14 = ~6.104e-05
0x03 = 00011_ = +0b1.0*2^-13 = ~0.0001
0x04 = 00100_ = +0b1.0*2^-12 = ~0.0002
0x05 = 00101_ = +0b1.0*2^-11 = ~0.0005
0x06 = 00110_ = +0b1.0*2^-10 = ~0.0010
0x07 = 00111_ = +0b1.0*2^-9  = ~0.0020
0x08 = 01000_ = +0b1.0*2^-8  = ~0.0039
0x09 = 01001_ = +0b1.0*2^-7  = ~0.0078
0x0a = 01010_ = +0b1.0*2^-6  = 0.015625
0x0b = 01011_ = +0b1.0*2^-5  = 0.03125
0x0c = 01100_ = +0b1.0*2^-4  = 0.0625
0x0d = 01101_ = +0b1.0*2^-3  = 0.125
0x0e = 01110_ = +0b1.0*2^-2  = 0.25
0x0f = 01111_ = +0b1.0*2^-1  = 0.5
0x10 = 10000_ = +0b1.0*2^0   = 1.0
0x11 = 10001_ = +0b1.0*2^1   = 2.0
0x12 = 10010_ = +0b1.0*2^2   = 4.0
0x13 = 10011_ = +0b1.0*2^3   = 8.0
0x14 = 10100_ = +0b1.0*2^4   = 16.0
0x15 = 10101_ = +0b1.0*2^5   = 32.0
0x16 = 10110_ = +0b1.0*2^6   = 64.0
0x17 = 10111_ = +0b1.0*2^7   = 128.0
0x18 = 11000_ = +0b1.0*2^8   = 256.0
0x19 = 11001_ = +0b1.0*2^9   = 512.0
0x1a = 11010_ = +0b1.0*2^10  = 1024.0
0x1b = 11011_ = +0b1.0*2^11  = 2048.0
0x1c = 11100_ = +0b1.0*2^12  = 4096.0
0x1d = 11101_ = +0b1.0*2^13  = 8192.0
0x1e = 11110_ = inf = inf
0x1f = 11111_ = nan = nan
0x00 = 00000_ = 0.0 = 0.0
0x01 = 00001_ = +0b1.0*2^-15 = ~3.052e-05
0x02 = 00010_ = +0b1.0*2^-14 = ~6.104e-05
0x03 = 00011_ = +0b1.0*2^-13 = ~0.0001
0x04 = 00100_ = +0b1.0*2^-12 = ~0.0002
0x05 = 00101_ = +0b1.0*2^-11 = ~0.0005
0x06 = 00110_ = +0b1.0*2^-10 = ~0.0010
0x07 = 00111_ = +0b1.0*2^-9  = ~0.0020
0x08 = 01000_ = +0b1.0*2^-8  = ~0.0039
0x09 = 01001_ = +0b1.0*2^-7  = ~0.0078
0x0a = 01010_ = +0b1.0*2^-6  = 0.015625
0x0b = 01011_ = +0b1.0*2^-5  = 0.03125
0x0c = 01100_ = +0b1.0*2^-4  = 0.0625
0x0d = 01101_ = +0b1.0*2^-3  = 0.125
0x0e = 01110_ = +0b1.0*2^-2  = 0.25
0x0f = 01111_ = +0b1.0*2^-1  = 0.5
0x10 = 10000_ = +0b1.0*2^0   = 1.0
0x11 = 10001_ = +0b1.0*2^1   = 2.0
0x12 = 10010_ = +0b1.0*2^2   = 4.0
0x13 = 10011_ = +0b1.0*2^3   = 8.0
0x14 = 10100_ = +0b1.0*2^4   = 16.0
0x15 = 10101_ = +0b1.0*2^5   = 32.0
0x16 = 10110_ = +0b1.0*2^6   = 64.0
0x17 = 10111_ = +0b1.0*2^7   = 128.0
0x18 = 11000_ = +0b1.0*2^8   = 256.0
0x19 = 11001_ = +0b1.0*2^9   = 512.0
0x1a = 11010_ = +0b1.0*2^10  = 1024.0
0x1b = 11011_ = +0b1.0*2^11  = 2048.0
0x1c = 11100_ = +0b1.0*2^12  = 4096.0
0x1d = 11101_ = +0b1.0*2^13  = 8192.0
0x1e = 11110_ = +0b1.0*2^14  = 16384.0
0x1f = 11111_ = nan = nan

p3109_k5p2se p3109_k5p2sf p3109_k5p2ue p3109_k5p2uf
0x00 = 0_000_0 = 0.0 = 0.0
0x01 = 0_000_1 = +0b0.1*2^-3  = 0.0625
0x02 = 0_001_0 = +0b1.0*2^-3  = 0.125
0x03 = 0_001_1 = +0b1.1*2^-3  = 0.1875
0x04 = 0_010_0 = +0b1.0*2^-2  = 0.25
0x05 = 0_010_1 = +0b1.1*2^-2  = 0.375
0x06 = 0_011_0 = +0b1.0*2^-1  = 0.5
0x07 = 0_011_1 = +0b1.1*2^-1  = 0.75
0x08 = 0_100_0 = +0b1.0*2^0   = 1.0
0x09 = 0_100_1 = +0b1.1*2^0   = 1.5
0x0a = 0_101_0 = +0b1.0*2^1   = 2.0
0x0b = 0_101_1 = +0b1.1*2^1   = 3.0
0x0c = 0_110_0 = +0b1.0*2^2   = 4.0
0x0d = 0_110_1 = +0b1.1*2^2   = 6.0
0x0e = 0_111_0 = +0b1.0*2^3   = 8.0
0x0f = 0_111_1 = inf = inf
0x10 = 1_000_0 = nan = nan
0x11 = 1_000_1 = -0b0.1*2^-3  = -0.0625
0x12 = 1_001_0 = -0b1.0*2^-3  = -0.125
0x13 = 1_001_1 = -0b1.1*2^-3  = -0.1875
0x14 = 1_010_0 = -0b1.0*2^-2  = -0.25
0x15 = 1_010_1 = -0b1.1*2^-2  = -0.375
0x16 = 1_011_0 = -0b1.0*2^-1  = -0.5
0x17 = 1_011_1 = -0b1.1*2^-1  = -0.75
0x18 = 1_100_0 = -0b1.0*2^0   = -1.0
0x19 = 1_100_1 = -0b1.1*2^0   = -1.5
0x1a = 1_101_0 = -0b1.0*2^1   = -2.0
0x1b = 1_101_1 = -0b1.1*2^1   = -3.0
0x1c = 1_110_0 = -0b1.0*2^2   = -4.0
0x1d = 1_110_1 = -0b1.1*2^2   = -6.0
0x1e = 1_111_0 = -0b1.0*2^3   = -8.0
0x1f = 1_111_1 = -inf = -inf
0x00 = 0_000_0 = 0.0 = 0.0
0x01 = 0_000_1 = +0b0.1*2^-3  = 0.0625
0x02 = 0_001_0 = +0b1.0*2^-3  = 0.125
0x03 = 0_001_1 = +0b1.1*2^-3  = 0.1875
0x04 = 0_010_0 = +0b1.0*2^-2  = 0.25
0x05 = 0_010_1 = +0b1.1*2^-2  = 0.375
0x06 = 0_011_0 = +0b1.0*2^-1  = 0.5
0x07 = 0_011_1 = +0b1.1*2^-1  = 0.75
0x08 = 0_100_0 = +0b1.0*2^0   = 1.0
0x09 = 0_100_1 = +0b1.1*2^0   = 1.5
0x0a = 0_101_0 = +0b1.0*2^1   = 2.0
0x0b = 0_101_1 = +0b1.1*2^1   = 3.0
0x0c = 0_110_0 = +0b1.0*2^2   = 4.0
0x0d = 0_110_1 = +0b1.1*2^2   = 6.0
0x0e = 0_111_0 = +0b1.0*2^3   = 8.0
0x0f = 0_111_1 = +0b1.1*2^3   = 12.0
0x10 = 1_000_0 = nan = nan
0x11 = 1_000_1 = -0b0.1*2^-3  = -0.0625
0x12 = 1_001_0 = -0b1.0*2^-3  = -0.125
0x13 = 1_001_1 = -0b1.1*2^-3  = -0.1875
0x14 = 1_010_0 = -0b1.0*2^-2  = -0.25
0x15 = 1_010_1 = -0b1.1*2^-2  = -0.375
0x16 = 1_011_0 = -0b1.0*2^-1  = -0.5
0x17 = 1_011_1 = -0b1.1*2^-1  = -0.75
0x18 = 1_100_0 = -0b1.0*2^0   = -1.0
0x19 = 1_100_1 = -0b1.1*2^0   = -1.5
0x1a = 1_101_0 = -0b1.0*2^1   = -2.0
0x1b = 1_101_1 = -0b1.1*2^1   = -3.0
0x1c = 1_110_0 = -0b1.0*2^2   = -4.0
0x1d = 1_110_1 = -0b1.1*2^2   = -6.0
0x1e = 1_111_0 = -0b1.0*2^3   = -8.0
0x1f = 1_111_1 = -0b1.1*2^3   = -12.0
0x00 = 0000_0 = 0.0 = 0.0
0x01 = 0000_1 = +0b0.1*2^-7  = ~0.0039
0x02 = 0001_0 = +0b1.0*2^-7  = ~0.0078
0x03 = 0001_1 = +0b1.1*2^-7  = ~0.0117
0x04 = 0010_0 = +0b1.0*2^-6  = 0.015625
0x05 = 0010_1 = +0b1.1*2^-6  = ~0.0234
0x06 = 0011_0 = +0b1.0*2^-5  = 0.03125
0x07 = 0011_1 = +0b1.1*2^-5  = 0.046875
0x08 = 0100_0 = +0b1.0*2^-4  = 0.0625
0x09 = 0100_1 = +0b1.1*2^-4  = 0.09375
0x0a = 0101_0 = +0b1.0*2^-3  = 0.125
0x0b = 0101_1 = +0b1.1*2^-3  = 0.1875
0x0c = 0110_0 = +0b1.0*2^-2  = 0.25
0x0d = 0110_1 = +0b1.1*2^-2  = 0.375
0x0e = 0111_0 = +0b1.0*2^-1  = 0.5
0x0f = 0111_1 = +0b1.1*2^-1  = 0.75
0x10 = 1000_0 = +0b1.0*2^0   = 1.0
0x11 = 1000_1 = +0b1.1*2^0   = 1.5
0x12 = 1001_0 = +0b1.0*2^1   = 2.0
0x13 = 1001_1 = +0b1.1*2^1   = 3.0
0x14 = 1010_0 = +0b1.0*2^2   = 4.0
0x15 = 1010_1 = +0b1.1*2^2   = 6.0
0x16 = 1011_0 = +0b1.0*2^3   = 8.0
0x17 = 1011_1 = +0b1.1*2^3   = 12.0
0x18 = 1100_0 = +0b1.0*2^4   = 16.0
0x19 = 1100_1 = +0b1.1*2^4   = 24.0
0x1a = 1101_0 = +0b1.0*2^5   = 32.0
0x1b = 1101_1 = +0b1.1*2^5   = 48.0
0x1c = 1110_0 = +0b1.0*2^6   = 64.0
0x1d = 1110_1 = +0b1.1*2^6   = 96.0
0x1e = 1111_0 = inf = inf
0x1f = 1111_1 = nan = nan
0x00 = 0000_0 = 0.0 = 0.0
0x01 = 0000_1 = +0b0.1*2^-7  = ~0.0039
0x02 = 0001_0 = +0b1.0*2^-7  = ~0.0078
0x03 = 0001_1 = +0b1.1*2^-7  = ~0.0117
0x04 = 0010_0 = +0b1.0*2^-6  = 0.015625
0x05 = 0010_1 = +0b1.1*2^-6  = ~0.0234
0x06 = 0011_0 = +0b1.0*2^-5  = 0.03125
0x07 = 0011_1 = +0b1.1*2^-5  = 0.046875
0x08 = 0100_0 = +0b1.0*2^-4  = 0.0625
0x09 = 0100_1 = +0b1.1*2^-4  = 0.09375
0x0a = 0101_0 = +0b1.0*2^-3  = 0.125
0x0b = 0101_1 = +0b1.1*2^-3  = 0.1875
0x0c = 0110_0 = +0b1.0*2^-2  = 0.25
0x0d = 0110_1 = +0b1.1*2^-2  = 0.375
0x0e = 0111_0 = +0b1.0*2^-1  = 0.5
0x0f = 0111_1 = +0b1.1*2^-1  = 0.75
0x10 = 1000_0 = +0b1.0*2^0   = 1.0
0x11 = 1000_1 = +0b1.1*2^0   = 1.5
0x12 = 1001_0 = +0b1.0*2^1   = 2.0
0x13 = 1001_1 = +0b1.1*2^1   = 3.0
0x14 = 1010_0 = +0b1.0*2^2   = 4.0
0x15 = 1010_1 = +0b1.1*2^2   = 6.0
0x16 = 1011_0 = +0b1.0*2^3   = 8.0
0x17 = 1011_1 = +0b1.1*2^3   = 12.0
0x18 = 1100_0 = +0b1.0*2^4   = 16.0
0x19 = 1100_1 = +0b1.1*2^4   = 24.0
0x1a = 1101_0 = +0b1.0*2^5   = 32.0
0x1b = 1101_1 = +0b1.1*2^5   = 48.0
0x1c = 1110_0 = +0b1.0*2^6   = 64.0
0x1d = 1110_1 = +0b1.1*2^6   = 96.0
0x1e = 1111_0 = +0b1.0*2^7   = 128.0
0x1f = 1111_1 = nan = nan

p3109_k5p3se p3109_k5p3sf p3109_k5p3ue p3109_k5p3uf
0x00 = 0_00_00 = 0.0 = 0.0
0x01 = 0_00_01 = +0b0.01*2^-1  = 0.125
0x02 = 0_00_10 = +0b0.10*2^-1  = 0.25
0x03 = 0_00_11 = +0b0.11*2^-1  = 0.375
0x04 = 0_01_00 = +0b1.00*2^-1  = 0.5
0x05 = 0_01_01 = +0b1.01*2^-1  = 0.625
0x06 = 0_01_10 = +0b1.10*2^-1  = 0.75
0x07 = 0_01_11 = +0b1.11*2^-1  = 0.875
0x08 = 0_10_00 = +0b1.00*2^0   = 1.0
0x09 = 0_10_01 = +0b1.01*2^0   = 1.25
0x0a = 0_10_10 = +0b1.10*2^0   = 1.5
0x0b = 0_10_11 = +0b1.11*2^0   = 1.75
0x0c = 0_11_00 = +0b1.00*2^1   = 2.0
0x0d = 0_11_01 = +0b1.01*2^1   = 2.5
0x0e = 0_11_10 = +0b1.10*2^1   = 3.0
0x0f = 0_11_11 = inf = inf
0x10 = 1_00_00 = nan = nan
0x11 = 1_00_01 = -0b0.01*2^-1  = -0.125
0x12 = 1_00_10 = -0b0.10*2^-1  = -0.25
0x13 = 1_00_11 = -0b0.11*2^-1  = -0.375
0x14 = 1_01_00 = -0b1.00*2^-1  = -0.5
0x15 = 1_01_01 = -0b1.01*2^-1  = -0.625
0x16 = 1_01_10 = -0b1.10*2^-1  = -0.75
0x17 = 1_01_11 = -0b1.11*2^-1  = -0.875
0x18 = 1_10_00 = -0b1.00*2^0   = -1.0
0x19 = 1_10_01 = -0b1.01*2^0   = -1.25
0x1a = 1_10_10 = -0b1.10*2^0   = -1.5
0x1b = 1_10_11 = -0b1.11*2^0   = -1.75
0x1c = 1_11_00 = -0b1.00*2^1   = -2.0
0x1d = 1_11_01 = -0b1.01*2^1   = -2.5
0x1e = 1_11_10 = -0b1.10*2^1   = -3.0
0x1f = 1_11_11 = -inf = -inf
0x00 = 0_00_00 = 0.0 = 0.0
0x01 = 0_00_01 = +0b0.01*2^-1  = 0.125
0x02 = 0_00_10 = +0b0.10*2^-1  = 0.25
0x03 = 0_00_11 = +0b0.11*2^-1  = 0.375
0x04 = 0_01_00 = +0b1.00*2^-1  = 0.5
0x05 = 0_01_01 = +0b1.01*2^-1  = 0.625
0x06 = 0_01_10 = +0b1.10*2^-1  = 0.75
0x07 = 0_01_11 = +0b1.11*2^-1  = 0.875
0x08 = 0_10_00 = +0b1.00*2^0   = 1.0
0x09 = 0_10_01 = +0b1.01*2^0   = 1.25
0x0a = 0_10_10 = +0b1.10*2^0   = 1.5
0x0b = 0_10_11 = +0b1.11*2^0   = 1.75
0x0c = 0_11_00 = +0b1.00*2^1   = 2.0
0x0d = 0_11_01 = +0b1.01*2^1   = 2.5
0x0e = 0_11_10 = +0b1.10*2^1   = 3.0
0x0f = 0_11_11 = +0b1.11*2^1   = 3.5
0x10 = 1_00_00 = nan = nan
0x11 = 1_00_01 = -0b0.01*2^-1  = -0.125
0x12 = 1_00_10 = -0b0.10*2^-1  = -0.25
0x13 = 1_00_11 = -0b0.11*2^-1  = -0.375
0x14 = 1_01_00 = -0b1.00*2^-1  = -0.5
0x15 = 1_01_01 = -0b1.01*2^-1  = -0.625
0x16 = 1_01_10 = -0b1.10*2^-1  = -0.75
0x17 = 1_01_11 = -0b1.11*2^-1  = -0.875
0x18 = 1_10_00 = -0b1.00*2^0   = -1.0
0x19 = 1_10_01 = -0b1.01*2^0   = -1.25
0x1a = 1_10_10 = -0b1.10*2^0   = -1.5
0x1b = 1_10_11 = -0b1.11*2^0   = -1.75
0x1c = 1_11_00 = -0b1.00*2^1   = -2.0
0x1d = 1_11_01 = -0b1.01*2^1   = -2.5
0x1e = 1_11_10 = -0b1.10*2^1   = -3.0
0x1f = 1_11_11 = -0b1.11*2^1   = -3.5
0x00 = 000_00 = 0.0 = 0.0
0x01 = 000_01 = +0b0.01*2^-3  = 0.03125
0x02 = 000_10 = +0b0.10*2^-3  = 0.0625
0x03 = 000_11 = +0b0.11*2^-3  = 0.09375
0x04 = 001_00 = +0b1.00*2^-3  = 0.125
0x05 = 001_01 = +0b1.01*2^-3  = 0.15625
0x06 = 001_10 = +0b1.10*2^-3  = 0.1875
0x07 = 001_11 = +0b1.11*2^-3  = 0.21875
0x08 = 010_00 = +0b1.00*2^-2  = 0.25
0x09 = 010_01 = +0b1.01*2^-2  = 0.3125
0x0a = 010_10 = +0b1.10*2^-2  = 0.375
0x0b = 010_11 = +0b1.11*2^-2  = 0.4375
0x0c = 011_00 = +0b1.00*2^-1  = 0.5
0x0d = 011_01 = +0b1.01*2^-1  = 0.625
0x0e = 011_10 = +0b1.10*2^-1  = 0.75
0x0f = 011_11 = +0b1.11*2^-1  = 0.875
0x10 = 100_00 = +0b1.00*2^0   = 1.0
0x11 = 100_01 = +0b1.01*2^0   = 1.25
0x12 = 100_10 = +0b1.10*2^0   = 1.5
0x13 = 100_11 = +0b1.11*2^0   = 1.75
0x14 = 101_00 = +0b1.00*2^1   = 2.0
0x15 = 101_01 = +0b1.01*2^1   = 2.5
0x16 = 101_10 = +0b1.10*2^1   = 3.0
0x17 = 101_11 = +0b1.11*2^1   = 3.5
0x18 = 110_00 = +0b1.00*2^2   = 4.0
0x19 = 110_01 = +0b1.01*2^2   = 5.0
0x1a = 110_10 = +0b1.10*2^2   = 6.0
0x1b = 110_11 = +0b1.11*2^2   = 7.0
0x1c = 111_00 = +0b1.00*2^3   = 8.0
0x1d = 111_01 = +0b1.01*2^3   = 10.0
0x1e = 111_10 = inf = inf
0x1f = 111_11 = nan = nan
0x00 = 000_00 = 0.0 = 0.0
0x01 = 000_01 = +0b0.01*2^-3  = 0.03125
0x02 = 000_10 = +0b0.10*2^-3  = 0.0625
0x03 = 000_11 = +0b0.11*2^-3  = 0.09375
0x04 = 001_00 = +0b1.00*2^-3  = 0.125
0x05 = 001_01 = +0b1.01*2^-3  = 0.15625
0x06 = 001_10 = +0b1.10*2^-3  = 0.1875
0x07 = 001_11 = +0b1.11*2^-3  = 0.21875
0x08 = 010_00 = +0b1.00*2^-2  = 0.25
0x09 = 010_01 = +0b1.01*2^-2  = 0.3125
0x0a = 010_10 = +0b1.10*2^-2  = 0.375
0x0b = 010_11 = +0b1.11*2^-2  = 0.4375
0x0c = 011_00 = +0b1.00*2^-1  = 0.5
0x0d = 011_01 = +0b1.01*2^-1  = 0.625
0x0e = 011_10 = +0b1.10*2^-1  = 0.75
0x0f = 011_11 = +0b1.11*2^-1  = 0.875
0x10 = 100_00 = +0b1.00*2^0   = 1.0
0x11 = 100_01 = +0b1.01*2^0   = 1.25
0x12 = 100_10 = +0b1.10*2^0   = 1.5
0x13 = 100_11 = +0b1.11*2^0   = 1.75
0x14 = 101_00 = +0b1.00*2^1   = 2.0
0x15 = 101_01 = +0b1.01*2^1   = 2.5
0x16 = 101_10 = +0b1.10*2^1   = 3.0
0x17 = 101_11 = +0b1.11*2^1   = 3.5
0x18 = 110_00 = +0b1.00*2^2   = 4.0
0x19 = 110_01 = +0b1.01*2^2   = 5.0
0x1a = 110_10 = +0b1.10*2^2   = 6.0
0x1b = 110_11 = +0b1.11*2^2   = 7.0
0x1c = 111_00 = +0b1.00*2^3   = 8.0
0x1d = 111_01 = +0b1.01*2^3   = 10.0
0x1e = 111_10 = +0b1.10*2^3   = 12.0
0x1f = 111_11 = nan = nan

p3109_k5p4se p3109_k5p4sf p3109_k5p4ue p3109_k5p4uf
0x00 = 0_0_000 = 0.0 = 0.0
0x01 = 0_0_001 = +0b0.001*2^0   = 0.125
0x02 = 0_0_010 = +0b0.010*2^0   = 0.25
0x03 = 0_0_011 = +0b0.011*2^0   = 0.375
0x04 = 0_0_100 = +0b0.100*2^0   = 0.5
0x05 = 0_0_101 = +0b0.101*2^0   = 0.625
0x06 = 0_0_110 = +0b0.110*2^0   = 0.75
0x07 = 0_0_111 = +0b0.111*2^0   = 0.875
0x08 = 0_1_000 = +0b1.000*2^0   = 1.0
0x09 = 0_1_001 = +0b1.001*2^0   = 1.125
0x0a = 0_1_010 = +0b1.010*2^0   = 1.25
0x0b = 0_1_011 = +0b1.011*2^0   = 1.375
0x0c = 0_1_100 = +0b1.100*2^0   = 1.5
0x0d = 0_1_101 = +0b1.101*2^0   = 1.625
0x0e = 0_1_110 = +0b1.110*2^0   = 1.75
0x0f = 0_1_111 = inf = inf
0x10 = 1_0_000 = nan = nan
0x11 = 1_0_001 = -0b0.001*2^0   = -0.125
0x12 = 1_0_010 = -0b0.010*2^0   = -0.25
0x13 = 1_0_011 = -0b0.011*2^0   = -0.375
0x14 = 1_0_100 = -0b0.100*2^0   = -0.5
0x15 = 1_0_101 = -0b0.101*2^0   = -0.625
0x16 = 1_0_110 = -0b0.110*2^0   = -0.75
0x17 = 1_0_111 = -0b0.111*2^0   = -0.875
0x18 = 1_1_000 = -0b1.000*2^0   = -1.0
0x19 = 1_1_001 = -0b1.001*2^0   = -1.125
0x1a = 1_1_010 = -0b1.010*2^0   = -1.25
0x1b = 1_1_011 = -0b1.011*2^0   = -1.375
0x1c = 1_1_100 = -0b1.100*2^0   = -1.5
0x1d = 1_1_101 = -0b1.101*2^0   = -1.625
0x1e = 1_1_110 = -0b1.110*2^0   = -1.75
0x1f = 1_1_111 = -inf = -inf
0x00 = 0_0_000 = 0.0 = 0.0
0x01 = 0_0_001 = +0b0.001*2^0   = 0.125
0x02 = 0_0_010 = +0b0.010*2^0   = 0.25
0x03 = 0_0_011 = +0b0.011*2^0   = 0.375
0x04 = 0_0_100 = +0b0.100*2^0   = 0.5
0x05 = 0_0_101 = +0b0.101*2^0   = 0.625
0x06 = 0_0_110 = +0b0.110*2^0   = 0.75
0x07 = 0_0_111 = +0b0.111*2^0   = 0.875
0x08 = 0_1_000 = +0b1.000*2^0   = 1.0
0x09 = 0_1_001 = +0b1.001*2^0   = 1.125
0x0a = 0_1_010 = +0b1.010*2^0   = 1.25
0x0b = 0_1_011 = +0b1.011*2^0   = 1.375
0x0c = 0_1_100 = +0b1.100*2^0   = 1.5
0x0d = 0_1_101 = +0b1.101*2^0   = 1.625
0x0e = 0_1_110 = +0b1.110*2^0   = 1.75
0x0f = 0_1_111 = +0b1.111*2^0   = 1.875
0x10 = 1_0_000 = nan = nan
0x11 = 1_0_001 = -0b0.001*2^0   = -0.125
0x12 = 1_0_010 = -0b0.010*2^0   = -0.25
0x13 = 1_0_011 = -0b0.011*2^0   = -0.375
0x14 = 1_0_100 = -0b0.100*2^0   = -0.5
0x15 = 1_0_101 = -0b0.101*2^0   = -0.625
0x16 = 1_0_110 = -0b0.110*2^0   = -0.75
0x17 = 1_0_111 = -0b0.111*2^0   = -0.875
0x18 = 1_1_000 = -0b1.000*2^0   = -1.0
0x19 = 1_1_001 = -0b1.001*2^0   = -1.125
0x1a = 1_1_010 = -0b1.010*2^0   = -1.25
0x1b = 1_1_011 = -0b1.011*2^0   = -1.375
0x1c = 1_1_100 = -0b1.100*2^0   = -1.5
0x1d = 1_1_101 = -0b1.101*2^0   = -1.625
0x1e = 1_1_110 = -0b1.110*2^0   = -1.75
0x1f = 1_1_111 = -0b1.111*2^0   = -1.875
0x00 = 00_000 = 0.0 = 0.0
0x01 = 00_001 = +0b0.001*2^-1  = 0.0625
0x02 = 00_010 = +0b0.010*2^-1  = 0.125
0x03 = 00_011 = +0b0.011*2^-1  = 0.1875
0x04 = 00_100 = +0b0.100*2^-1  = 0.25
0x05 = 00_101 = +0b0.101*2^-1  = 0.3125
0x06 = 00_110 = +0b0.110*2^-1  = 0.375
0x07 = 00_111 = +0b0.111*2^-1  = 0.4375
0x08 = 01_000 = +0b1.000*2^-1  = 0.5
0x09 = 01_001 = +0b1.001*2^-1  = 0.5625
0x0a = 01_010 = +0b1.010*2^-1  = 0.625
0x0b = 01_011 = +0b1.011*2^-1  = 0.6875
0x0c = 01_100 = +0b1.100*2^-1  = 0.75
0x0d = 01_101 = +0b1.101*2^-1  = 0.8125
0x0e = 01_110 = +0b1.110*2^-1  = 0.875
0x0f = 01_111 = +0b1.111*2^-1  = 0.9375
0x10 = 10_000 = +0b1.000*2^0   = 1.0
0x11 = 10_001 = +0b1.001*2^0   = 1.125
0x12 = 10_010 = +0b1.010*2^0   = 1.25
0x13 = 10_011 = +0b1.011*2^0   = 1.375
0x14 = 10_100 = +0b1.100*2^0   = 1.5
0x15 = 10_101 = +0b1.101*2^0   = 1.625
0x16 = 10_110 = +0b1.110*2^0   = 1.75
0x17 = 10_111 = +0b1.111*2^0   = 1.875
0x18 = 11_000 = +0b1.000*2^1   = 2.0
0x19 = 11_001 = +0b1.001*2^1   = 2.25
0x1a = 11_010 = +0b1.010*2^1   = 2.5
0x1b = 11_011 = +0b1.011*2^1   = 2.75
0x1c = 11_100 = +0b1.100*2^1   = 3.0
0x1d = 11_101 = +0b1.101*2^1   = 3.25
0x1e = 11_110 = inf = inf
0x1f = 11_111 = nan = nan
0x00 = 00_000 = 0.0 = 0.0
0x01 = 00_001 = +0b0.001*2^-1  = 0.0625
0x02 = 00_010 = +0b0.010*2^-1  = 0.125
0x03 = 00_011 = +0b0.011*2^-1  = 0.1875
0x04 = 00_100 = +0b0.100*2^-1  = 0.25
0x05 = 00_101 = +0b0.101*2^-1  = 0.3125
0x06 = 00_110 = +0b0.110*2^-1  = 0.375
0x07 = 00_111 = +0b0.111*2^-1  = 0.4375
0x08 = 01_000 = +0b1.000*2^-1  = 0.5
0x09 = 01_001 = +0b1.001*2^-1  = 0.5625
0x0a = 01_010 = +0b1.010*2^-1  = 0.625
0x0b = 01_011 = +0b1.011*2^-1  = 0.6875
0x0c = 01_100 = +0b1.100*2^-1  = 0.75
0x0d = 01_101 = +0b1.101*2^-1  = 0.8125
0x0e = 01_110 = +0b1.110*2^-1  = 0.875
0x0f = 01_111 = +0b1.111*2^-1  = 0.9375
0x10 = 10_000 = +0b1.000*2^0   = 1.0
0x11 = 10_001 = +0b1.001*2^0   = 1.125
0x12 = 10_010 = +0b1.010*2^0   = 1.25
0x13 = 10_011 = +0b1.011*2^0   = 1.375
0x14 = 10_100 = +0b1.100*2^0   = 1.5
0x15 = 10_101 = +0b1.101*2^0   = 1.625
0x16 = 10_110 = +0b1.110*2^0   = 1.75
0x17 = 10_111 = +0b1.111*2^0   = 1.875
0x18 = 11_000 = +0b1.000*2^1   = 2.0
0x19 = 11_001 = +0b1.001*2^1   = 2.25
0x1a = 11_010 = +0b1.010*2^1   = 2.5
0x1b = 11_011 = +0b1.011*2^1   = 2.75
0x1c = 11_100 = +0b1.100*2^1   = 3.0
0x1d = 11_101 = +0b1.101*2^1   = 3.25
0x1e = 11_110 = +0b1.110*2^1   = 3.5
0x1f = 11_111 = nan = nan

p3109_k5p5se p3109_k5p5sf p3109_k5p5ue p3109_k5p5uf
0x00 = 0_0000 = 0.0 = 0.0
0x01 = 0_0001 = +0b0.0001*2^1   = 0.125
0x02 = 0_0010 = +0b0.0010*2^1   = 0.25
0x03 = 0_0011 = +0b0.0011*2^1   = 0.375
0x04 = 0_0100 = +0b0.0100*2^1   = 0.5
0x05 = 0_0101 = +0b0.0101*2^1   = 0.625
0x06 = 0_0110 = +0b0.0110*2^1   = 0.75
0x07 = 0_0111 = +0b0.0111*2^1   = 0.875
0x08 = 0_1000 = +0b0.1000*2^1   = 1.0
0x09 = 0_1001 = +0b0.1001*2^1   = 1.125
0x0a = 0_1010 = +0b0.1010*2^1   = 1.25
0x0b = 0_1011 = +0b0.1011*2^1   = 1.375
0x0c = 0_1100 = +0b0.1100*2^1   = 1.5
0x0d = 0_1101 = +0b0.1101*2^1   = 1.625
0x0e = 0_1110 = +0b0.1110*2^1   = 1.75
0x0f = 0_1111 = inf = inf
0x10 = 1_0000 = nan = nan
0x11 = 1_0001 = -0b0.0001*2^1   = -0.125
0x12 = 1_0010 = -0b0.0010*2^1   = -0.25
0x13 = 1_0011 = -0b0.0011*2^1   = -0.375
0x14 = 1_0100 = -0b0.0100*2^1   = -0.5
0x15 = 1_0101 = -0b0.0101*2^1   = -0.625
0x16 = 1_0110 = -0b0.0110*2^1   = -0.75
0x17 = 1_0111 = -0b0.0111*2^1   = -0.875
0x18 = 1_1000 = -0b0.1000*2^1   = -1.0
0x19 = 1_1001 = -0b0.1001*2^1   = -1.125
0x1a = 1_1010 = -0b0.1010*2^1   = -1.25
0x1b = 1_1011 = -0b0.1011*2^1   = -1.375
0x1c = 1_1100 = -0b0.1100*2^1   = -1.5
0x1d = 1_1101 = -0b0.1101*2^1   = -1.625
0x1e = 1_1110 = -0b0.1110*2^1   = -1.75
0x1f = 1_1111 = -inf = -inf
0x00 = 0_0000 = 0.0 = 0.0
0x01 = 0_0001 = +0b0.0001*2^1   = 0.125
0x02 = 0_0010 = +0b0.0010*2^1   = 0.25
0x03 = 0_0011 = +0b0.0011*2^1   = 0.375
0x04 = 0_0100 = +0b0.0100*2^1   = 0.5
0x05 = 0_0101 = +0b0.0101*2^1   = 0.625
0x06 = 0_0110 = +0b0.0110*2^1   = 0.75
0x07 = 0_0111 = +0b0.0111*2^1   = 0.875
0x08 = 0_1000 = +0b0.1000*2^1   = 1.0
0x09 = 0_1001 = +0b0.1001*2^1   = 1.125
0x0a = 0_1010 = +0b0.1010*2^1   = 1.25
0x0b = 0_1011 = +0b0.1011*2^1   = 1.375
0x0c = 0_1100 = +0b0.1100*2^1   = 1.5
0x0d = 0_1101 = +0b0.1101*2^1   = 1.625
0x0e = 0_1110 = +0b0.1110*2^1   = 1.75
0x0f = 0_1111 = +0b0.1111*2^1   = 1.875
0x10 = 1_0000 = nan = nan
0x11 = 1_0001 = -0b0.0001*2^1   = -0.125
0x12 = 1_0010 = -0b0.0010*2^1   = -0.25
0x13 = 1_0011 = -0b0.0011*2^1   = -0.375
0x14 = 1_0100 = -0b0.0100*2^1   = -0.5
0x15 = 1_0101 = -0b0.0101*2^1   = -0.625
0x16 = 1_0110 = -0b0.0110*2^1   = -0.75
0x17 = 1_0111 = -0b0.0111*2^1   = -0.875
0x18 = 1_1000 = -0b0.1000*2^1   = -1.0
0x19 = 1_1001 = -0b0.1001*2^1   = -1.125
0x1a = 1_1010 = -0b0.1010*2^1   = -1.25
0x1b = 1_1011 = -0b0.1011*2^1   = -1.375
0x1c = 1_1100 = -0b0.1100*2^1   = -1.5
0x1d = 1_1101 = -0b0.1101*2^1   = -1.625
0x1e = 1_1110 = -0b0.1110*2^1   = -1.75
0x1f = 1_1111 = -0b0.1111*2^1   = -1.875
0x00 = 0_0000 = 0.0 = 0.0
0x01 = 0_0001 = +0b0.0001*2^0   = 0.0625
0x02 = 0_0010 = +0b0.0010*2^0   = 0.125
0x03 = 0_0011 = +0b0.0011*2^0   = 0.1875
0x04 = 0_0100 = +0b0.0100*2^0   = 0.25
0x05 = 0_0101 = +0b0.0101*2^0   = 0.3125
0x06 = 0_0110 = +0b0.0110*2^0   = 0.375
0x07 = 0_0111 = +0b0.0111*2^0   = 0.4375
0x08 = 0_1000 = +0b0.1000*2^0   = 0.5
0x09 = 0_1001 = +0b0.1001*2^0   = 0.5625
0x0a = 0_1010 = +0b0.1010*2^0   = 0.625
0x0b = 0_1011 = +0b0.1011*2^0   = 0.6875
0x0c = 0_1100 = +0b0.1100*2^0   = 0.75
0x0d = 0_1101 = +0b0.1101*2^0   = 0.8125
0x0e = 0_1110 = +0b0.1110*2^0   = 0.875
0x0f = 0_1111 = +0b0.1111*2^0   = 0.9375
0x10 = 1_0000 = +0b1.0000*2^0   = 1.0
0x11 = 1_0001 = +0b1.0001*2^0   = 1.0625
0x12 = 1_0010 = +0b1.0010*2^0   = 1.125
0x13 = 1_0011 = +0b1.0011*2^0   = 1.1875
0x14 = 1_0100 = +0b1.0100*2^0   = 1.25
0x15 = 1_0101 = +0b1.0101*2^0   = 1.3125
0x16 = 1_0110 = +0b1.0110*2^0   = 1.375
0x17 = 1_0111 = +0b1.0111*2^0   = 1.4375
0x18 = 1_1000 = +0b1.1000*2^0   = 1.5
0x19 = 1_1001 = +0b1.1001*2^0   = 1.5625
0x1a = 1_1010 = +0b1.1010*2^0   = 1.625
0x1b = 1_1011 = +0b1.1011*2^0   = 1.6875
0x1c = 1_1100 = +0b1.1100*2^0   = 1.75
0x1d = 1_1101 = +0b1.1101*2^0   = 1.8125
0x1e = 1_1110 = inf = inf
0x1f = 1_1111 = nan = nan
0x00 = 0_0000 = 0.0 = 0.0
0x01 = 0_0001 = +0b0.0001*2^0   = 0.0625
0x02 = 0_0010 = +0b0.0010*2^0   = 0.125
0x03 = 0_0011 = +0b0.0011*2^0   = 0.1875
0x04 = 0_0100 = +0b0.0100*2^0   = 0.25
0x05 = 0_0101 = +0b0.0101*2^0   = 0.3125
0x06 = 0_0110 = +0b0.0110*2^0   = 0.375
0x07 = 0_0111 = +0b0.0111*2^0   = 0.4375
0x08 = 0_1000 = +0b0.1000*2^0   = 0.5
0x09 = 0_1001 = +0b0.1001*2^0   = 0.5625
0x0a = 0_1010 = +0b0.1010*2^0   = 0.625
0x0b = 0_1011 = +0b0.1011*2^0   = 0.6875
0x0c = 0_1100 = +0b0.1100*2^0   = 0.75
0x0d = 0_1101 = +0b0.1101*2^0   = 0.8125
0x0e = 0_1110 = +0b0.1110*2^0   = 0.875
0x0f = 0_1111 = +0b0.1111*2^0   = 0.9375
0x10 = 1_0000 = +0b1.0000*2^0   = 1.0
0x11 = 1_0001 = +0b1.0001*2^0   = 1.0625
0x12 = 1_0010 = +0b1.0010*2^0   = 1.125
0x13 = 1_0011 = +0b1.0011*2^0   = 1.1875
0x14 = 1_0100 = +0b1.0100*2^0   = 1.25
0x15 = 1_0101 = +0b1.0101*2^0   = 1.3125
0x16 = 1_0110 = +0b1.0110*2^0   = 1.375
0x17 = 1_0111 = +0b1.0111*2^0   = 1.4375
0x18 = 1_1000 = +0b1.1000*2^0   = 1.5
0x19 = 1_1001 = +0b1.1001*2^0   = 1.5625
0x1a = 1_1010 = +0b1.1010*2^0   = 1.625
0x1b = 1_1011 = +0b1.1011*2^0   = 1.6875
0x1c = 1_1100 = +0b1.1100*2^0   = 1.75
0x1d = 1_1101 = +0b1.1101*2^0   = 1.8125
0x1e = 1_1110 = +0b1.1110*2^0   = 1.875
0x1f = 1_1111 = nan = nan

Now check unsigned vs signed, k=6

for p in (2, 3):
    fis = [
        format_info_p3109(6, p, signedness, domain)
        for signedness in (Signedness.Signed, Signedness.Unsigned)
        for domain in (Domain.Extended, Domain.Finite)
    ]
    render(fis, short=False)

p3109_k6p2se p3109_k6p2sf p3109_k6p2ue p3109_k6p2uf
0x00 = 0_0000_0 = 0.0 = 0.0
0x01 = 0_0000_1 = +0b0.1*2^-7  = ~0.0039
0x02 = 0_0001_0 = +0b1.0*2^-7  = ~0.0078
0x03 = 0_0001_1 = +0b1.1*2^-7  = ~0.0117
0x04 = 0_0010_0 = +0b1.0*2^-6  = 0.015625
0x05 = 0_0010_1 = +0b1.1*2^-6  = ~0.0234
0x06 = 0_0011_0 = +0b1.0*2^-5  = 0.03125
0x07 = 0_0011_1 = +0b1.1*2^-5  = 0.046875
0x08 = 0_0100_0 = +0b1.0*2^-4  = 0.0625
0x09 = 0_0100_1 = +0b1.1*2^-4  = 0.09375
0x0a = 0_0101_0 = +0b1.0*2^-3  = 0.125
0x0b = 0_0101_1 = +0b1.1*2^-3  = 0.1875
0x0c = 0_0110_0 = +0b1.0*2^-2  = 0.25
0x0d = 0_0110_1 = +0b1.1*2^-2  = 0.375
0x0e = 0_0111_0 = +0b1.0*2^-1  = 0.5
0x0f = 0_0111_1 = +0b1.1*2^-1  = 0.75
0x10 = 0_1000_0 = +0b1.0*2^0   = 1.0
0x11 = 0_1000_1 = +0b1.1*2^0   = 1.5
0x12 = 0_1001_0 = +0b1.0*2^1   = 2.0
0x13 = 0_1001_1 = +0b1.1*2^1   = 3.0
0x14 = 0_1010_0 = +0b1.0*2^2   = 4.0
0x15 = 0_1010_1 = +0b1.1*2^2   = 6.0
0x16 = 0_1011_0 = +0b1.0*2^3   = 8.0
0x17 = 0_1011_1 = +0b1.1*2^3   = 12.0
0x18 = 0_1100_0 = +0b1.0*2^4   = 16.0
0x19 = 0_1100_1 = +0b1.1*2^4   = 24.0
0x1a = 0_1101_0 = +0b1.0*2^5   = 32.0
0x1b = 0_1101_1 = +0b1.1*2^5   = 48.0
0x1c = 0_1110_0 = +0b1.0*2^6   = 64.0
0x1d = 0_1110_1 = +0b1.1*2^6   = 96.0
0x1e = 0_1111_0 = +0b1.0*2^7   = 128.0
0x1f = 0_1111_1 = inf = inf
0x20 = 1_0000_0 = nan = nan
0x21 = 1_0000_1 = -0b0.1*2^-7  = ~-0.0039
0x22 = 1_0001_0 = -0b1.0*2^-7  = ~-0.0078
0x23 = 1_0001_1 = -0b1.1*2^-7  = ~-0.0117
0x24 = 1_0010_0 = -0b1.0*2^-6  = ~-0.0156
0x25 = 1_0010_1 = -0b1.1*2^-6  = ~-0.0234
0x26 = 1_0011_0 = -0b1.0*2^-5  = -0.03125
0x27 = 1_0011_1 = -0b1.1*2^-5  = ~-0.0469
0x28 = 1_0100_0 = -0b1.0*2^-4  = -0.0625
0x29 = 1_0100_1 = -0b1.1*2^-4  = -0.09375
0x2a = 1_0101_0 = -0b1.0*2^-3  = -0.125
0x2b = 1_0101_1 = -0b1.1*2^-3  = -0.1875
0x2c = 1_0110_0 = -0b1.0*2^-2  = -0.25
0x2d = 1_0110_1 = -0b1.1*2^-2  = -0.375
0x2e = 1_0111_0 = -0b1.0*2^-1  = -0.5
0x2f = 1_0111_1 = -0b1.1*2^-1  = -0.75
0x30 = 1_1000_0 = -0b1.0*2^0   = -1.0
0x31 = 1_1000_1 = -0b1.1*2^0   = -1.5
0x32 = 1_1001_0 = -0b1.0*2^1   = -2.0
0x33 = 1_1001_1 = -0b1.1*2^1   = -3.0
0x34 = 1_1010_0 = -0b1.0*2^2   = -4.0
0x35 = 1_1010_1 = -0b1.1*2^2   = -6.0
0x36 = 1_1011_0 = -0b1.0*2^3   = -8.0
0x37 = 1_1011_1 = -0b1.1*2^3   = -12.0
0x38 = 1_1100_0 = -0b1.0*2^4   = -16.0
0x39 = 1_1100_1 = -0b1.1*2^4   = -24.0
0x3a = 1_1101_0 = -0b1.0*2^5   = -32.0
0x3b = 1_1101_1 = -0b1.1*2^5   = -48.0
0x3c = 1_1110_0 = -0b1.0*2^6   = -64.0
0x3d = 1_1110_1 = -0b1.1*2^6   = -96.0
0x3e = 1_1111_0 = -0b1.0*2^7   = -128.0
0x3f = 1_1111_1 = -inf = -inf
0x00 = 0_0000_0 = 0.0 = 0.0
0x01 = 0_0000_1 = +0b0.1*2^-7  = ~0.0039
0x02 = 0_0001_0 = +0b1.0*2^-7  = ~0.0078
0x03 = 0_0001_1 = +0b1.1*2^-7  = ~0.0117
0x04 = 0_0010_0 = +0b1.0*2^-6  = 0.015625
0x05 = 0_0010_1 = +0b1.1*2^-6  = ~0.0234
0x06 = 0_0011_0 = +0b1.0*2^-5  = 0.03125
0x07 = 0_0011_1 = +0b1.1*2^-5  = 0.046875
0x08 = 0_0100_0 = +0b1.0*2^-4  = 0.0625
0x09 = 0_0100_1 = +0b1.1*2^-4  = 0.09375
0x0a = 0_0101_0 = +0b1.0*2^-3  = 0.125
0x0b = 0_0101_1 = +0b1.1*2^-3  = 0.1875
0x0c = 0_0110_0 = +0b1.0*2^-2  = 0.25
0x0d = 0_0110_1 = +0b1.1*2^-2  = 0.375
0x0e = 0_0111_0 = +0b1.0*2^-1  = 0.5
0x0f = 0_0111_1 = +0b1.1*2^-1  = 0.75
0x10 = 0_1000_0 = +0b1.0*2^0   = 1.0
0x11 = 0_1000_1 = +0b1.1*2^0   = 1.5
0x12 = 0_1001_0 = +0b1.0*2^1   = 2.0
0x13 = 0_1001_1 = +0b1.1*2^1   = 3.0
0x14 = 0_1010_0 = +0b1.0*2^2   = 4.0
0x15 = 0_1010_1 = +0b1.1*2^2   = 6.0
0x16 = 0_1011_0 = +0b1.0*2^3   = 8.0
0x17 = 0_1011_1 = +0b1.1*2^3   = 12.0
0x18 = 0_1100_0 = +0b1.0*2^4   = 16.0
0x19 = 0_1100_1 = +0b1.1*2^4   = 24.0
0x1a = 0_1101_0 = +0b1.0*2^5   = 32.0
0x1b = 0_1101_1 = +0b1.1*2^5   = 48.0
0x1c = 0_1110_0 = +0b1.0*2^6   = 64.0
0x1d = 0_1110_1 = +0b1.1*2^6   = 96.0
0x1e = 0_1111_0 = +0b1.0*2^7   = 128.0
0x1f = 0_1111_1 = +0b1.1*2^7   = 192.0
0x20 = 1_0000_0 = nan = nan
0x21 = 1_0000_1 = -0b0.1*2^-7  = ~-0.0039
0x22 = 1_0001_0 = -0b1.0*2^-7  = ~-0.0078
0x23 = 1_0001_1 = -0b1.1*2^-7  = ~-0.0117
0x24 = 1_0010_0 = -0b1.0*2^-6  = ~-0.0156
0x25 = 1_0010_1 = -0b1.1*2^-6  = ~-0.0234
0x26 = 1_0011_0 = -0b1.0*2^-5  = -0.03125
0x27 = 1_0011_1 = -0b1.1*2^-5  = ~-0.0469
0x28 = 1_0100_0 = -0b1.0*2^-4  = -0.0625
0x29 = 1_0100_1 = -0b1.1*2^-4  = -0.09375
0x2a = 1_0101_0 = -0b1.0*2^-3  = -0.125
0x2b = 1_0101_1 = -0b1.1*2^-3  = -0.1875
0x2c = 1_0110_0 = -0b1.0*2^-2  = -0.25
0x2d = 1_0110_1 = -0b1.1*2^-2  = -0.375
0x2e = 1_0111_0 = -0b1.0*2^-1  = -0.5
0x2f = 1_0111_1 = -0b1.1*2^-1  = -0.75
0x30 = 1_1000_0 = -0b1.0*2^0   = -1.0
0x31 = 1_1000_1 = -0b1.1*2^0   = -1.5
0x32 = 1_1001_0 = -0b1.0*2^1   = -2.0
0x33 = 1_1001_1 = -0b1.1*2^1   = -3.0
0x34 = 1_1010_0 = -0b1.0*2^2   = -4.0
0x35 = 1_1010_1 = -0b1.1*2^2   = -6.0
0x36 = 1_1011_0 = -0b1.0*2^3   = -8.0
0x37 = 1_1011_1 = -0b1.1*2^3   = -12.0
0x38 = 1_1100_0 = -0b1.0*2^4   = -16.0
0x39 = 1_1100_1 = -0b1.1*2^4   = -24.0
0x3a = 1_1101_0 = -0b1.0*2^5   = -32.0
0x3b = 1_1101_1 = -0b1.1*2^5   = -48.0
0x3c = 1_1110_0 = -0b1.0*2^6   = -64.0
0x3d = 1_1110_1 = -0b1.1*2^6   = -96.0
0x3e = 1_1111_0 = -0b1.0*2^7   = -128.0
0x3f = 1_1111_1 = -0b1.1*2^7   = -192.0
0x00 = 00000_0 = 0.0 = 0.0
0x01 = 00000_1 = +0b0.1*2^-15 = ~1.526e-05
0x02 = 00001_0 = +0b1.0*2^-15 = ~3.052e-05
0x03 = 00001_1 = +0b1.1*2^-15 = ~4.578e-05
0x04 = 00010_0 = +0b1.0*2^-14 = ~6.104e-05
0x05 = 00010_1 = +0b1.1*2^-14 = ~9.155e-05
0x06 = 00011_0 = +0b1.0*2^-13 = ~0.0001
0x07 = 00011_1 = +0b1.1*2^-13 = ~0.0002
0x08 = 00100_0 = +0b1.0*2^-12 = ~0.0002
0x09 = 00100_1 = +0b1.1*2^-12 = ~0.0004
0x0a = 00101_0 = +0b1.0*2^-11 = ~0.0005
0x0b = 00101_1 = +0b1.1*2^-11 = ~0.0007
0x0c = 00110_0 = +0b1.0*2^-10 = ~0.0010
0x0d = 00110_1 = +0b1.1*2^-10 = ~0.0015
0x0e = 00111_0 = +0b1.0*2^-9  = ~0.0020
0x0f = 00111_1 = +0b1.1*2^-9  = ~0.0029
0x10 = 01000_0 = +0b1.0*2^-8  = ~0.0039
0x11 = 01000_1 = +0b1.1*2^-8  = ~0.0059
0x12 = 01001_0 = +0b1.0*2^-7  = ~0.0078
0x13 = 01001_1 = +0b1.1*2^-7  = ~0.0117
0x14 = 01010_0 = +0b1.0*2^-6  = 0.015625
0x15 = 01010_1 = +0b1.1*2^-6  = ~0.0234
0x16 = 01011_0 = +0b1.0*2^-5  = 0.03125
0x17 = 01011_1 = +0b1.1*2^-5  = 0.046875
0x18 = 01100_0 = +0b1.0*2^-4  = 0.0625
0x19 = 01100_1 = +0b1.1*2^-4  = 0.09375
0x1a = 01101_0 = +0b1.0*2^-3  = 0.125
0x1b = 01101_1 = +0b1.1*2^-3  = 0.1875
0x1c = 01110_0 = +0b1.0*2^-2  = 0.25
0x1d = 01110_1 = +0b1.1*2^-2  = 0.375
0x1e = 01111_0 = +0b1.0*2^-1  = 0.5
0x1f = 01111_1 = +0b1.1*2^-1  = 0.75
0x20 = 10000_0 = +0b1.0*2^0   = 1.0
0x21 = 10000_1 = +0b1.1*2^0   = 1.5
0x22 = 10001_0 = +0b1.0*2^1   = 2.0
0x23 = 10001_1 = +0b1.1*2^1   = 3.0
0x24 = 10010_0 = +0b1.0*2^2   = 4.0
0x25 = 10010_1 = +0b1.1*2^2   = 6.0
0x26 = 10011_0 = +0b1.0*2^3   = 8.0
0x27 = 10011_1 = +0b1.1*2^3   = 12.0
0x28 = 10100_0 = +0b1.0*2^4   = 16.0
0x29 = 10100_1 = +0b1.1*2^4   = 24.0
0x2a = 10101_0 = +0b1.0*2^5   = 32.0
0x2b = 10101_1 = +0b1.1*2^5   = 48.0
0x2c = 10110_0 = +0b1.0*2^6   = 64.0
0x2d = 10110_1 = +0b1.1*2^6   = 96.0
0x2e = 10111_0 = +0b1.0*2^7   = 128.0
0x2f = 10111_1 = +0b1.1*2^7   = 192.0
0x30 = 11000_0 = +0b1.0*2^8   = 256.0
0x31 = 11000_1 = +0b1.1*2^8   = 384.0
0x32 = 11001_0 = +0b1.0*2^9   = 512.0
0x33 = 11001_1 = +0b1.1*2^9   = 768.0
0x34 = 11010_0 = +0b1.0*2^10  = 1024.0
0x35 = 11010_1 = +0b1.1*2^10  = 1536.0
0x36 = 11011_0 = +0b1.0*2^11  = 2048.0
0x37 = 11011_1 = +0b1.1*2^11  = 3072.0
0x38 = 11100_0 = +0b1.0*2^12  = 4096.0
0x39 = 11100_1 = +0b1.1*2^12  = 6144.0
0x3a = 11101_0 = +0b1.0*2^13  = 8192.0
0x3b = 11101_1 = +0b1.1*2^13  = 12288.0
0x3c = 11110_0 = +0b1.0*2^14  = 16384.0
0x3d = 11110_1 = +0b1.1*2^14  = 24576.0
0x3e = 11111_0 = inf = inf
0x3f = 11111_1 = nan = nan
0x00 = 00000_0 = 0.0 = 0.0
0x01 = 00000_1 = +0b0.1*2^-15 = ~1.526e-05
0x02 = 00001_0 = +0b1.0*2^-15 = ~3.052e-05
0x03 = 00001_1 = +0b1.1*2^-15 = ~4.578e-05
0x04 = 00010_0 = +0b1.0*2^-14 = ~6.104e-05
0x05 = 00010_1 = +0b1.1*2^-14 = ~9.155e-05
0x06 = 00011_0 = +0b1.0*2^-13 = ~0.0001
0x07 = 00011_1 = +0b1.1*2^-13 = ~0.0002
0x08 = 00100_0 = +0b1.0*2^-12 = ~0.0002
0x09 = 00100_1 = +0b1.1*2^-12 = ~0.0004
0x0a = 00101_0 = +0b1.0*2^-11 = ~0.0005
0x0b = 00101_1 = +0b1.1*2^-11 = ~0.0007
0x0c = 00110_0 = +0b1.0*2^-10 = ~0.0010
0x0d = 00110_1 = +0b1.1*2^-10 = ~0.0015
0x0e = 00111_0 = +0b1.0*2^-9  = ~0.0020
0x0f = 00111_1 = +0b1.1*2^-9  = ~0.0029
0x10 = 01000_0 = +0b1.0*2^-8  = ~0.0039
0x11 = 01000_1 = +0b1.1*2^-8  = ~0.0059
0x12 = 01001_0 = +0b1.0*2^-7  = ~0.0078
0x13 = 01001_1 = +0b1.1*2^-7  = ~0.0117
0x14 = 01010_0 = +0b1.0*2^-6  = 0.015625
0x15 = 01010_1 = +0b1.1*2^-6  = ~0.0234
0x16 = 01011_0 = +0b1.0*2^-5  = 0.03125
0x17 = 01011_1 = +0b1.1*2^-5  = 0.046875
0x18 = 01100_0 = +0b1.0*2^-4  = 0.0625
0x19 = 01100_1 = +0b1.1*2^-4  = 0.09375
0x1a = 01101_0 = +0b1.0*2^-3  = 0.125
0x1b = 01101_1 = +0b1.1*2^-3  = 0.1875
0x1c = 01110_0 = +0b1.0*2^-2  = 0.25
0x1d = 01110_1 = +0b1.1*2^-2  = 0.375
0x1e = 01111_0 = +0b1.0*2^-1  = 0.5
0x1f = 01111_1 = +0b1.1*2^-1  = 0.75
0x20 = 10000_0 = +0b1.0*2^0   = 1.0
0x21 = 10000_1 = +0b1.1*2^0   = 1.5
0x22 = 10001_0 = +0b1.0*2^1   = 2.0
0x23 = 10001_1 = +0b1.1*2^1   = 3.0
0x24 = 10010_0 = +0b1.0*2^2   = 4.0
0x25 = 10010_1 = +0b1.1*2^2   = 6.0
0x26 = 10011_0 = +0b1.0*2^3   = 8.0
0x27 = 10011_1 = +0b1.1*2^3   = 12.0
0x28 = 10100_0 = +0b1.0*2^4   = 16.0
0x29 = 10100_1 = +0b1.1*2^4   = 24.0
0x2a = 10101_0 = +0b1.0*2^5   = 32.0
0x2b = 10101_1 = +0b1.1*2^5   = 48.0
0x2c = 10110_0 = +0b1.0*2^6   = 64.0
0x2d = 10110_1 = +0b1.1*2^6   = 96.0
0x2e = 10111_0 = +0b1.0*2^7   = 128.0
0x2f = 10111_1 = +0b1.1*2^7   = 192.0
0x30 = 11000_0 = +0b1.0*2^8   = 256.0
0x31 = 11000_1 = +0b1.1*2^8   = 384.0
0x32 = 11001_0 = +0b1.0*2^9   = 512.0
0x33 = 11001_1 = +0b1.1*2^9   = 768.0
0x34 = 11010_0 = +0b1.0*2^10  = 1024.0
0x35 = 11010_1 = +0b1.1*2^10  = 1536.0
0x36 = 11011_0 = +0b1.0*2^11  = 2048.0
0x37 = 11011_1 = +0b1.1*2^11  = 3072.0
0x38 = 11100_0 = +0b1.0*2^12  = 4096.0
0x39 = 11100_1 = +0b1.1*2^12  = 6144.0
0x3a = 11101_0 = +0b1.0*2^13  = 8192.0
0x3b = 11101_1 = +0b1.1*2^13  = 12288.0
0x3c = 11110_0 = +0b1.0*2^14  = 16384.0
0x3d = 11110_1 = +0b1.1*2^14  = 24576.0
0x3e = 11111_0 = +0b1.0*2^15  = 32768.0
0x3f = 11111_1 = nan = nan

p3109_k6p3se p3109_k6p3sf p3109_k6p3ue p3109_k6p3uf
0x00 = 0_000_00 = 0.0 = 0.0
0x01 = 0_000_01 = +0b0.01*2^-3  = 0.03125
0x02 = 0_000_10 = +0b0.10*2^-3  = 0.0625
0x03 = 0_000_11 = +0b0.11*2^-3  = 0.09375
0x04 = 0_001_00 = +0b1.00*2^-3  = 0.125
0x05 = 0_001_01 = +0b1.01*2^-3  = 0.15625
0x06 = 0_001_10 = +0b1.10*2^-3  = 0.1875
0x07 = 0_001_11 = +0b1.11*2^-3  = 0.21875
0x08 = 0_010_00 = +0b1.00*2^-2  = 0.25
0x09 = 0_010_01 = +0b1.01*2^-2  = 0.3125
0x0a = 0_010_10 = +0b1.10*2^-2  = 0.375
0x0b = 0_010_11 = +0b1.11*2^-2  = 0.4375
0x0c = 0_011_00 = +0b1.00*2^-1  = 0.5
0x0d = 0_011_01 = +0b1.01*2^-1  = 0.625
0x0e = 0_011_10 = +0b1.10*2^-1  = 0.75
0x0f = 0_011_11 = +0b1.11*2^-1  = 0.875
0x10 = 0_100_00 = +0b1.00*2^0   = 1.0
0x11 = 0_100_01 = +0b1.01*2^0   = 1.25
0x12 = 0_100_10 = +0b1.10*2^0   = 1.5
0x13 = 0_100_11 = +0b1.11*2^0   = 1.75
0x14 = 0_101_00 = +0b1.00*2^1   = 2.0
0x15 = 0_101_01 = +0b1.01*2^1   = 2.5
0x16 = 0_101_10 = +0b1.10*2^1   = 3.0
0x17 = 0_101_11 = +0b1.11*2^1   = 3.5
0x18 = 0_110_00 = +0b1.00*2^2   = 4.0
0x19 = 0_110_01 = +0b1.01*2^2   = 5.0
0x1a = 0_110_10 = +0b1.10*2^2   = 6.0
0x1b = 0_110_11 = +0b1.11*2^2   = 7.0
0x1c = 0_111_00 = +0b1.00*2^3   = 8.0
0x1d = 0_111_01 = +0b1.01*2^3   = 10.0
0x1e = 0_111_10 = +0b1.10*2^3   = 12.0
0x1f = 0_111_11 = inf = inf
0x20 = 1_000_00 = nan = nan
0x21 = 1_000_01 = -0b0.01*2^-3  = -0.03125
0x22 = 1_000_10 = -0b0.10*2^-3  = -0.0625
0x23 = 1_000_11 = -0b0.11*2^-3  = -0.09375
0x24 = 1_001_00 = -0b1.00*2^-3  = -0.125
0x25 = 1_001_01 = -0b1.01*2^-3  = -0.15625
0x26 = 1_001_10 = -0b1.10*2^-3  = -0.1875
0x27 = 1_001_11 = -0b1.11*2^-3  = -0.21875
0x28 = 1_010_00 = -0b1.00*2^-2  = -0.25
0x29 = 1_010_01 = -0b1.01*2^-2  = -0.3125
0x2a = 1_010_10 = -0b1.10*2^-2  = -0.375
0x2b = 1_010_11 = -0b1.11*2^-2  = -0.4375
0x2c = 1_011_00 = -0b1.00*2^-1  = -0.5
0x2d = 1_011_01 = -0b1.01*2^-1  = -0.625
0x2e = 1_011_10 = -0b1.10*2^-1  = -0.75
0x2f = 1_011_11 = -0b1.11*2^-1  = -0.875
0x30 = 1_100_00 = -0b1.00*2^0   = -1.0
0x31 = 1_100_01 = -0b1.01*2^0   = -1.25
0x32 = 1_100_10 = -0b1.10*2^0   = -1.5
0x33 = 1_100_11 = -0b1.11*2^0   = -1.75
0x34 = 1_101_00 = -0b1.00*2^1   = -2.0
0x35 = 1_101_01 = -0b1.01*2^1   = -2.5
0x36 = 1_101_10 = -0b1.10*2^1   = -3.0
0x37 = 1_101_11 = -0b1.11*2^1   = -3.5
0x38 = 1_110_00 = -0b1.00*2^2   = -4.0
0x39 = 1_110_01 = -0b1.01*2^2   = -5.0
0x3a = 1_110_10 = -0b1.10*2^2   = -6.0
0x3b = 1_110_11 = -0b1.11*2^2   = -7.0
0x3c = 1_111_00 = -0b1.00*2^3   = -8.0
0x3d = 1_111_01 = -0b1.01*2^3   = -10.0
0x3e = 1_111_10 = -0b1.10*2^3   = -12.0
0x3f = 1_111_11 = -inf = -inf
0x00 = 0_000_00 = 0.0 = 0.0
0x01 = 0_000_01 = +0b0.01*2^-3  = 0.03125
0x02 = 0_000_10 = +0b0.10*2^-3  = 0.0625
0x03 = 0_000_11 = +0b0.11*2^-3  = 0.09375
0x04 = 0_001_00 = +0b1.00*2^-3  = 0.125
0x05 = 0_001_01 = +0b1.01*2^-3  = 0.15625
0x06 = 0_001_10 = +0b1.10*2^-3  = 0.1875
0x07 = 0_001_11 = +0b1.11*2^-3  = 0.21875
0x08 = 0_010_00 = +0b1.00*2^-2  = 0.25
0x09 = 0_010_01 = +0b1.01*2^-2  = 0.3125
0x0a = 0_010_10 = +0b1.10*2^-2  = 0.375
0x0b = 0_010_11 = +0b1.11*2^-2  = 0.4375
0x0c = 0_011_00 = +0b1.00*2^-1  = 0.5
0x0d = 0_011_01 = +0b1.01*2^-1  = 0.625
0x0e = 0_011_10 = +0b1.10*2^-1  = 0.75
0x0f = 0_011_11 = +0b1.11*2^-1  = 0.875
0x10 = 0_100_00 = +0b1.00*2^0   = 1.0
0x11 = 0_100_01 = +0b1.01*2^0   = 1.25
0x12 = 0_100_10 = +0b1.10*2^0   = 1.5
0x13 = 0_100_11 = +0b1.11*2^0   = 1.75
0x14 = 0_101_00 = +0b1.00*2^1   = 2.0
0x15 = 0_101_01 = +0b1.01*2^1   = 2.5
0x16 = 0_101_10 = +0b1.10*2^1   = 3.0
0x17 = 0_101_11 = +0b1.11*2^1   = 3.5
0x18 = 0_110_00 = +0b1.00*2^2   = 4.0
0x19 = 0_110_01 = +0b1.01*2^2   = 5.0
0x1a = 0_110_10 = +0b1.10*2^2   = 6.0
0x1b = 0_110_11 = +0b1.11*2^2   = 7.0
0x1c = 0_111_00 = +0b1.00*2^3   = 8.0
0x1d = 0_111_01 = +0b1.01*2^3   = 10.0
0x1e = 0_111_10 = +0b1.10*2^3   = 12.0
0x1f = 0_111_11 = +0b1.11*2^3   = 14.0
0x20 = 1_000_00 = nan = nan
0x21 = 1_000_01 = -0b0.01*2^-3  = -0.03125
0x22 = 1_000_10 = -0b0.10*2^-3  = -0.0625
0x23 = 1_000_11 = -0b0.11*2^-3  = -0.09375
0x24 = 1_001_00 = -0b1.00*2^-3  = -0.125
0x25 = 1_001_01 = -0b1.01*2^-3  = -0.15625
0x26 = 1_001_10 = -0b1.10*2^-3  = -0.1875
0x27 = 1_001_11 = -0b1.11*2^-3  = -0.21875
0x28 = 1_010_00 = -0b1.00*2^-2  = -0.25
0x29 = 1_010_01 = -0b1.01*2^-2  = -0.3125
0x2a = 1_010_10 = -0b1.10*2^-2  = -0.375
0x2b = 1_010_11 = -0b1.11*2^-2  = -0.4375
0x2c = 1_011_00 = -0b1.00*2^-1  = -0.5
0x2d = 1_011_01 = -0b1.01*2^-1  = -0.625
0x2e = 1_011_10 = -0b1.10*2^-1  = -0.75
0x2f = 1_011_11 = -0b1.11*2^-1  = -0.875
0x30 = 1_100_00 = -0b1.00*2^0   = -1.0
0x31 = 1_100_01 = -0b1.01*2^0   = -1.25
0x32 = 1_100_10 = -0b1.10*2^0   = -1.5
0x33 = 1_100_11 = -0b1.11*2^0   = -1.75
0x34 = 1_101_00 = -0b1.00*2^1   = -2.0
0x35 = 1_101_01 = -0b1.01*2^1   = -2.5
0x36 = 1_101_10 = -0b1.10*2^1   = -3.0
0x37 = 1_101_11 = -0b1.11*2^1   = -3.5
0x38 = 1_110_00 = -0b1.00*2^2   = -4.0
0x39 = 1_110_01 = -0b1.01*2^2   = -5.0
0x3a = 1_110_10 = -0b1.10*2^2   = -6.0
0x3b = 1_110_11 = -0b1.11*2^2   = -7.0
0x3c = 1_111_00 = -0b1.00*2^3   = -8.0
0x3d = 1_111_01 = -0b1.01*2^3   = -10.0
0x3e = 1_111_10 = -0b1.10*2^3   = -12.0
0x3f = 1_111_11 = -0b1.11*2^3   = -14.0
0x00 = 0000_00 = 0.0 = 0.0
0x01 = 0000_01 = +0b0.01*2^-7  = ~0.0020
0x02 = 0000_10 = +0b0.10*2^-7  = ~0.0039
0x03 = 0000_11 = +0b0.11*2^-7  = ~0.0059
0x04 = 0001_00 = +0b1.00*2^-7  = ~0.0078
0x05 = 0001_01 = +0b1.01*2^-7  = ~0.0098
0x06 = 0001_10 = +0b1.10*2^-7  = ~0.0117
0x07 = 0001_11 = +0b1.11*2^-7  = ~0.0137
0x08 = 0010_00 = +0b1.00*2^-6  = 0.015625
0x09 = 0010_01 = +0b1.01*2^-6  = ~0.0195
0x0a = 0010_10 = +0b1.10*2^-6  = ~0.0234
0x0b = 0010_11 = +0b1.11*2^-6  = ~0.0273
0x0c = 0011_00 = +0b1.00*2^-5  = 0.03125
0x0d = 0011_01 = +0b1.01*2^-5  = ~0.0391
0x0e = 0011_10 = +0b1.10*2^-5  = 0.046875
0x0f = 0011_11 = +0b1.11*2^-5  = ~0.0547
0x10 = 0100_00 = +0b1.00*2^-4  = 0.0625
0x11 = 0100_01 = +0b1.01*2^-4  = 0.078125
0x12 = 0100_10 = +0b1.10*2^-4  = 0.09375
0x13 = 0100_11 = +0b1.11*2^-4  = 0.109375
0x14 = 0101_00 = +0b1.00*2^-3  = 0.125
0x15 = 0101_01 = +0b1.01*2^-3  = 0.15625
0x16 = 0101_10 = +0b1.10*2^-3  = 0.1875
0x17 = 0101_11 = +0b1.11*2^-3  = 0.21875
0x18 = 0110_00 = +0b1.00*2^-2  = 0.25
0x19 = 0110_01 = +0b1.01*2^-2  = 0.3125
0x1a = 0110_10 = +0b1.10*2^-2  = 0.375
0x1b = 0110_11 = +0b1.11*2^-2  = 0.4375
0x1c = 0111_00 = +0b1.00*2^-1  = 0.5
0x1d = 0111_01 = +0b1.01*2^-1  = 0.625
0x1e = 0111_10 = +0b1.10*2^-1  = 0.75
0x1f = 0111_11 = +0b1.11*2^-1  = 0.875
0x20 = 1000_00 = +0b1.00*2^0   = 1.0
0x21 = 1000_01 = +0b1.01*2^0   = 1.25
0x22 = 1000_10 = +0b1.10*2^0   = 1.5
0x23 = 1000_11 = +0b1.11*2^0   = 1.75
0x24 = 1001_00 = +0b1.00*2^1   = 2.0
0x25 = 1001_01 = +0b1.01*2^1   = 2.5
0x26 = 1001_10 = +0b1.10*2^1   = 3.0
0x27 = 1001_11 = +0b1.11*2^1   = 3.5
0x28 = 1010_00 = +0b1.00*2^2   = 4.0
0x29 = 1010_01 = +0b1.01*2^2   = 5.0
0x2a = 1010_10 = +0b1.10*2^2   = 6.0
0x2b = 1010_11 = +0b1.11*2^2   = 7.0
0x2c = 1011_00 = +0b1.00*2^3   = 8.0
0x2d = 1011_01 = +0b1.01*2^3   = 10.0
0x2e = 1011_10 = +0b1.10*2^3   = 12.0
0x2f = 1011_11 = +0b1.11*2^3   = 14.0
0x30 = 1100_00 = +0b1.00*2^4   = 16.0
0x31 = 1100_01 = +0b1.01*2^4   = 20.0
0x32 = 1100_10 = +0b1.10*2^4   = 24.0
0x33 = 1100_11 = +0b1.11*2^4   = 28.0
0x34 = 1101_00 = +0b1.00*2^5   = 32.0
0x35 = 1101_01 = +0b1.01*2^5   = 40.0
0x36 = 1101_10 = +0b1.10*2^5   = 48.0
0x37 = 1101_11 = +0b1.11*2^5   = 56.0
0x38 = 1110_00 = +0b1.00*2^6   = 64.0
0x39 = 1110_01 = +0b1.01*2^6   = 80.0
0x3a = 1110_10 = +0b1.10*2^6   = 96.0
0x3b = 1110_11 = +0b1.11*2^6   = 112.0
0x3c = 1111_00 = +0b1.00*2^7   = 128.0
0x3d = 1111_01 = +0b1.01*2^7   = 160.0
0x3e = 1111_10 = inf = inf
0x3f = 1111_11 = nan = nan
0x00 = 0000_00 = 0.0 = 0.0
0x01 = 0000_01 = +0b0.01*2^-7  = ~0.0020
0x02 = 0000_10 = +0b0.10*2^-7  = ~0.0039
0x03 = 0000_11 = +0b0.11*2^-7  = ~0.0059
0x04 = 0001_00 = +0b1.00*2^-7  = ~0.0078
0x05 = 0001_01 = +0b1.01*2^-7  = ~0.0098
0x06 = 0001_10 = +0b1.10*2^-7  = ~0.0117
0x07 = 0001_11 = +0b1.11*2^-7  = ~0.0137
0x08 = 0010_00 = +0b1.00*2^-6  = 0.015625
0x09 = 0010_01 = +0b1.01*2^-6  = ~0.0195
0x0a = 0010_10 = +0b1.10*2^-6  = ~0.0234
0x0b = 0010_11 = +0b1.11*2^-6  = ~0.0273
0x0c = 0011_00 = +0b1.00*2^-5  = 0.03125
0x0d = 0011_01 = +0b1.01*2^-5  = ~0.0391
0x0e = 0011_10 = +0b1.10*2^-5  = 0.046875
0x0f = 0011_11 = +0b1.11*2^-5  = ~0.0547
0x10 = 0100_00 = +0b1.00*2^-4  = 0.0625
0x11 = 0100_01 = +0b1.01*2^-4  = 0.078125
0x12 = 0100_10 = +0b1.10*2^-4  = 0.09375
0x13 = 0100_11 = +0b1.11*2^-4  = 0.109375
0x14 = 0101_00 = +0b1.00*2^-3  = 0.125
0x15 = 0101_01 = +0b1.01*2^-3  = 0.15625
0x16 = 0101_10 = +0b1.10*2^-3  = 0.1875
0x17 = 0101_11 = +0b1.11*2^-3  = 0.21875
0x18 = 0110_00 = +0b1.00*2^-2  = 0.25
0x19 = 0110_01 = +0b1.01*2^-2  = 0.3125
0x1a = 0110_10 = +0b1.10*2^-2  = 0.375
0x1b = 0110_11 = +0b1.11*2^-2  = 0.4375
0x1c = 0111_00 = +0b1.00*2^-1  = 0.5
0x1d = 0111_01 = +0b1.01*2^-1  = 0.625
0x1e = 0111_10 = +0b1.10*2^-1  = 0.75
0x1f = 0111_11 = +0b1.11*2^-1  = 0.875
0x20 = 1000_00 = +0b1.00*2^0   = 1.0
0x21 = 1000_01 = +0b1.01*2^0   = 1.25
0x22 = 1000_10 = +0b1.10*2^0   = 1.5
0x23 = 1000_11 = +0b1.11*2^0   = 1.75
0x24 = 1001_00 = +0b1.00*2^1   = 2.0
0x25 = 1001_01 = +0b1.01*2^1   = 2.5
0x26 = 1001_10 = +0b1.10*2^1   = 3.0
0x27 = 1001_11 = +0b1.11*2^1   = 3.5
0x28 = 1010_00 = +0b1.00*2^2   = 4.0
0x29 = 1010_01 = +0b1.01*2^2   = 5.0
0x2a = 1010_10 = +0b1.10*2^2   = 6.0
0x2b = 1010_11 = +0b1.11*2^2   = 7.0
0x2c = 1011_00 = +0b1.00*2^3   = 8.0
0x2d = 1011_01 = +0b1.01*2^3   = 10.0
0x2e = 1011_10 = +0b1.10*2^3   = 12.0
0x2f = 1011_11 = +0b1.11*2^3   = 14.0
0x30 = 1100_00 = +0b1.00*2^4   = 16.0
0x31 = 1100_01 = +0b1.01*2^4   = 20.0
0x32 = 1100_10 = +0b1.10*2^4   = 24.0
0x33 = 1100_11 = +0b1.11*2^4   = 28.0
0x34 = 1101_00 = +0b1.00*2^5   = 32.0
0x35 = 1101_01 = +0b1.01*2^5   = 40.0
0x36 = 1101_10 = +0b1.10*2^5   = 48.0
0x37 = 1101_11 = +0b1.11*2^5   = 56.0
0x38 = 1110_00 = +0b1.00*2^6   = 64.0
0x39 = 1110_01 = +0b1.01*2^6   = 80.0
0x3a = 1110_10 = +0b1.10*2^6   = 96.0
0x3b = 1110_11 = +0b1.11*2^6   = 112.0
0x3c = 1111_00 = +0b1.00*2^7   = 128.0
0x3d = 1111_01 = +0b1.01*2^7   = 160.0
0x3e = 1111_10 = +0b1.10*2^7   = 192.0
0x3f = 1111_11 = nan = nan

IEEE P3109 4-bit formats

The IEEE P3109 interim report describes a family of formats parameterized by K and P, in which three 4-bit formats are defined.

The p=2 format is similar to OCP E2M1, with inf and nan:

HTML(airdoc(*mktbl(Airium(), format_info_p3109(4, 2), cols=2, width=8, d=3)))
FP4 Value Table, p3109_k4p2se

FP4 Value Table, p3109_k4p2se

0x00 = 0_00_0 = 0.0 = 0.0
0x08 = 1_00_0 = nan = nan
0x01 = 0_00_1 = +0b0.1*2^-1  = 0.25
0x09 = 1_00_1 = -0b0.1*2^-1  = -0.25
0x02 = 0_01_0 = +0b1.0*2^-1  = 0.5
0x0a = 1_01_0 = -0b1.0*2^-1  = -0.5
0x03 = 0_01_1 = +0b1.1*2^-1  = 0.75
0x0b = 1_01_1 = -0b1.1*2^-1  = -0.75
0x04 = 0_10_0 = +0b1.0*2^0   = 1.0
0x0c = 1_10_0 = -0b1.0*2^0   = -1.0
0x05 = 0_10_1 = +0b1.1*2^0   = 1.5
0x0d = 1_10_1 = -0b1.1*2^0   = -1.5
0x06 = 0_11_0 = +0b1.0*2^1   = 2.0
0x0e = 1_11_0 = -0b1.0*2^1   = -2.0
0x07 = 0_11_1 = inf = inf
0x0f = 1_11_1 = -inf = -inf

While the p=1 format is a “pure exponential” format with values 2^-2 to 2^3:

HTML(airdoc(*mktbl(Airium(), format_info_p3109(4, 1), cols=2, width=8, d=3)))
FP4 Value Table, p3109_k4p1se

FP4 Value Table, p3109_k4p1se

0x00 = 0_000_ = 0.0 = 0.0
0x08 = 1_000_ = nan = nan
0x01 = 0_001_ = +0b1.0*2^-3  = 0.125
0x09 = 1_001_ = -0b1.0*2^-3  = -0.125
0x02 = 0_010_ = +0b1.0*2^-2  = 0.25
0x0a = 1_010_ = -0b1.0*2^-2  = -0.25
0x03 = 0_011_ = +0b1.0*2^-1  = 0.5
0x0b = 1_011_ = -0b1.0*2^-1  = -0.5
0x04 = 0_100_ = +0b1.0*2^0   = 1.0
0x0c = 1_100_ = -0b1.0*2^0   = -1.0
0x05 = 0_101_ = +0b1.0*2^1   = 2.0
0x0d = 1_101_ = -0b1.0*2^1   = -2.0
0x06 = 0_110_ = +0b1.0*2^2   = 4.0
0x0e = 1_110_ = -0b1.0*2^2   = -4.0
0x07 = 0_111_ = inf = inf
0x0f = 1_111_ = -inf = -inf

And p=3, a linear format with values 0.25 * range(7)

HTML(airdoc(*mktbl(Airium(), format_info_p3109(4, 3), cols=2, width=8, d=3)))
FP4 Value Table, p3109_k4p3se

FP4 Value Table, p3109_k4p3se

0x00 = 0_0_00 = 0.0 = 0.0
0x08 = 1_0_00 = nan = nan
0x01 = 0_0_01 = +0b0.01*2^0   = 0.25
0x09 = 1_0_01 = -0b0.01*2^0   = -0.25
0x02 = 0_0_10 = +0b0.10*2^0   = 0.5
0x0a = 1_0_10 = -0b0.10*2^0   = -0.5
0x03 = 0_0_11 = +0b0.11*2^0   = 0.75
0x0b = 1_0_11 = -0b0.11*2^0   = -0.75
0x04 = 0_1_00 = +0b1.00*2^0   = 1.0
0x0c = 1_1_00 = -0b1.00*2^0   = -1.0
0x05 = 0_1_01 = +0b1.01*2^0   = 1.25
0x0d = 1_1_01 = -0b1.01*2^0   = -1.25
0x06 = 0_1_10 = +0b1.10*2^0   = 1.5
0x0e = 1_1_10 = -0b1.10*2^0   = -1.5
0x07 = 0_1_11 = inf = inf
0x0f = 1_1_11 = -inf = -inf

OCP E2M3

This 6-bit format has 32 values, with no NaN or Inf, but does have -0. The positive subnormals are the linear ramp of eighths: [n/8 for n in 1:7].

One might describe the format in text as:

zero to one by eighths, two to four by quarters, four to eight by halves

where “to” is open-ended, or “to” is not “thru”.

HTML(airdoc(*mktbl(Airium(), format_info_ocp_e2m3, cols=2, width=8, d=3)))
FP6 Value Table, ocp_e2m3

FP6 Value Table, ocp_e2m3

0x00 = 0_00_000 = 0.0 = 0.0
0x20 = 1_00_000 = -0.0 = -0.0
0x01 = 0_00_001 = +0b0.001*2^0   = 0.125
0x21 = 1_00_001 = -0b0.001*2^0   = -0.125
0x02 = 0_00_010 = +0b0.010*2^0   = 0.25
0x22 = 1_00_010 = -0b0.010*2^0   = -0.25
0x03 = 0_00_011 = +0b0.011*2^0   = 0.375
0x23 = 1_00_011 = -0b0.011*2^0   = -0.375
0x04 = 0_00_100 = +0b0.100*2^0   = 0.5
0x24 = 1_00_100 = -0b0.100*2^0   = -0.5
0x05 = 0_00_101 = +0b0.101*2^0   = 0.625
0x25 = 1_00_101 = -0b0.101*2^0   = -0.625
0x06 = 0_00_110 = +0b0.110*2^0   = 0.75
0x26 = 1_00_110 = -0b0.110*2^0   = -0.75
0x07 = 0_00_111 = +0b0.111*2^0   = 0.875
0x27 = 1_00_111 = -0b0.111*2^0   = -0.875
0x08 = 0_01_000 = +0b1.000*2^0   = 1.0
0x28 = 1_01_000 = -0b1.000*2^0   = -1.0
0x09 = 0_01_001 = +0b1.001*2^0   = 1.125
0x29 = 1_01_001 = -0b1.001*2^0   = -1.125
0x0a = 0_01_010 = +0b1.010*2^0   = 1.25
0x2a = 1_01_010 = -0b1.010*2^0   = -1.25
0x0b = 0_01_011 = +0b1.011*2^0   = 1.375
0x2b = 1_01_011 = -0b1.011*2^0   = -1.375
0x0c = 0_01_100 = +0b1.100*2^0   = 1.5
0x2c = 1_01_100 = -0b1.100*2^0   = -1.5
0x0d = 0_01_101 = +0b1.101*2^0   = 1.625
0x2d = 1_01_101 = -0b1.101*2^0   = -1.625
0x0e = 0_01_110 = +0b1.110*2^0   = 1.75
0x2e = 1_01_110 = -0b1.110*2^0   = -1.75
0x0f = 0_01_111 = +0b1.111*2^0   = 1.875
0x2f = 1_01_111 = -0b1.111*2^0   = -1.875
0x10 = 0_10_000 = +0b1.000*2^1   = 2.0
0x30 = 1_10_000 = -0b1.000*2^1   = -2.0
0x11 = 0_10_001 = +0b1.001*2^1   = 2.25
0x31 = 1_10_001 = -0b1.001*2^1   = -2.25
0x12 = 0_10_010 = +0b1.010*2^1   = 2.5
0x32 = 1_10_010 = -0b1.010*2^1   = -2.5
0x13 = 0_10_011 = +0b1.011*2^1   = 2.75
0x33 = 1_10_011 = -0b1.011*2^1   = -2.75
0x14 = 0_10_100 = +0b1.100*2^1   = 3.0
0x34 = 1_10_100 = -0b1.100*2^1   = -3.0
0x15 = 0_10_101 = +0b1.101*2^1   = 3.25
0x35 = 1_10_101 = -0b1.101*2^1   = -3.25
0x16 = 0_10_110 = +0b1.110*2^1   = 3.5
0x36 = 1_10_110 = -0b1.110*2^1   = -3.5
0x17 = 0_10_111 = +0b1.111*2^1   = 3.75
0x37 = 1_10_111 = -0b1.111*2^1   = -3.75
0x18 = 0_11_000 = +0b1.000*2^2   = 4.0
0x38 = 1_11_000 = -0b1.000*2^2   = -4.0
0x19 = 0_11_001 = +0b1.001*2^2   = 4.5
0x39 = 1_11_001 = -0b1.001*2^2   = -4.5
0x1a = 0_11_010 = +0b1.010*2^2   = 5.0
0x3a = 1_11_010 = -0b1.010*2^2   = -5.0
0x1b = 0_11_011 = +0b1.011*2^2   = 5.5
0x3b = 1_11_011 = -0b1.011*2^2   = -5.5
0x1c = 0_11_100 = +0b1.100*2^2   = 6.0
0x3c = 1_11_100 = -0b1.100*2^2   = -6.0
0x1d = 0_11_101 = +0b1.101*2^2   = 6.5
0x3d = 1_11_101 = -0b1.101*2^2   = -6.5
0x1e = 0_11_110 = +0b1.110*2^2   = 7.0
0x3e = 1_11_110 = -0b1.110*2^2   = -7.0
0x1f = 0_11_111 = +0b1.111*2^2   = 7.5
0x3f = 1_11_111 = -0b1.111*2^2   = -7.5

OCP Formats: E5M2, E4M3

# HTML(mktbl(format_info_ocp_e5m2, cols=4, skip_rows=(0x10, 0x30), vs_width=8, vs_d=5))
HTML(
    airdoc(
        *mktbl(
            Airium(),
            format_info_ocp_e5m2,
            skip_rows=range(0x10, 0x30),
            cols=4,
            width=8,
            d=3,
        )
    )
)
FP8 Value Table, ocp_e5m2

FP8 Value Table, ocp_e5m2

0x00 = 0_00000_00 = 0.0 = 0.0
0x40 = 0_10000_00 = +0b1.00*2^1   = 2.0
0x80 = 1_00000_00 = -0.0 = -0.0
0xc0 = 1_10000_00 = -0b1.00*2^1   = -2.0
0x01 = 0_00000_01 = +0b0.01*2^-14 = ~1.53e-05
0x41 = 0_10000_01 = +0b1.01*2^1   = 2.5
0x81 = 1_00000_01 = -0b0.01*2^-14 = ~-1.53e-05
0xc1 = 1_10000_01 = -0b1.01*2^1   = -2.5
0x02 = 0_00000_10 = +0b0.10*2^-14 = ~3.05e-05
0x42 = 0_10000_10 = +0b1.10*2^1   = 3.0
0x82 = 1_00000_10 = -0b0.10*2^-14 = ~-3.05e-05
0xc2 = 1_10000_10 = -0b1.10*2^1   = -3.0
0x03 = 0_00000_11 = +0b0.11*2^-14 = ~4.58e-05
0x43 = 0_10000_11 = +0b1.11*2^1   = 3.5
0x83 = 1_00000_11 = -0b0.11*2^-14 = ~-4.58e-05
0xc3 = 1_10000_11 = -0b1.11*2^1   = -3.5
0x04 = 0_00001_00 = +0b1.00*2^-14 = ~6.1e-05
0x44 = 0_10001_00 = +0b1.00*2^2   = 4.0
0x84 = 1_00001_00 = -0b1.00*2^-14 = ~-6.1e-05
0xc4 = 1_10001_00 = -0b1.00*2^2   = -4.0
0x05 = 0_00001_01 = +0b1.01*2^-14 = ~7.63e-05
0x45 = 0_10001_01 = +0b1.01*2^2   = 5.0
0x85 = 1_00001_01 = -0b1.01*2^-14 = ~-7.63e-05
0xc5 = 1_10001_01 = -0b1.01*2^2   = -5.0
0x06 = 0_00001_10 = +0b1.10*2^-14 = ~9.16e-05
0x46 = 0_10001_10 = +0b1.10*2^2   = 6.0
0x86 = 1_00001_10 = -0b1.10*2^-14 = ~-9.16e-05
0xc6 = 1_10001_10 = -0b1.10*2^2   = -6.0
0x07 = 0_00001_11 = +0b1.11*2^-14 = ~0.000
0x47 = 0_10001_11 = +0b1.11*2^2   = 7.0
0x87 = 1_00001_11 = -0b1.11*2^-14 = ~-0.000
0xc7 = 1_10001_11 = -0b1.11*2^2   = -7.0
0x08 = 0_00010_00 = +0b1.00*2^-13 = ~0.000
0x48 = 0_10010_00 = +0b1.00*2^3   = 8.0
0x88 = 1_00010_00 = -0b1.00*2^-13 = ~-0.000
0xc8 = 1_10010_00 = -0b1.00*2^3   = -8.0
0x09 = 0_00010_01 = +0b1.01*2^-13 = ~0.000
0x49 = 0_10010_01 = +0b1.01*2^3   = 10.0
0x89 = 1_00010_01 = -0b1.01*2^-13 = ~-0.000
0xc9 = 1_10010_01 = -0b1.01*2^3   = -10.0
0x0a = 0_00010_10 = +0b1.10*2^-13 = ~0.000
0x4a = 0_10010_10 = +0b1.10*2^3   = 12.0
0x8a = 1_00010_10 = -0b1.10*2^-13 = ~-0.000
0xca = 1_10010_10 = -0b1.10*2^3   = -12.0
0x0b = 0_00010_11 = +0b1.11*2^-13 = ~0.000
0x4b = 0_10010_11 = +0b1.11*2^3   = 14.0
0x8b = 1_00010_11 = -0b1.11*2^-13 = ~-0.000
0xcb = 1_10010_11 = -0b1.11*2^3   = -14.0
0x0c = 0_00011_00 = +0b1.00*2^-12 = ~0.000
0x4c = 0_10011_00 = +0b1.00*2^4   = 16.0
0x8c = 1_00011_00 = -0b1.00*2^-12 = ~-0.000
0xcc = 1_10011_00 = -0b1.00*2^4   = -16.0
0x0d = 0_00011_01 = +0b1.01*2^-12 = ~0.000
0x4d = 0_10011_01 = +0b1.01*2^4   = 20.0
0x8d = 1_00011_01 = -0b1.01*2^-12 = ~-0.000
0xcd = 1_10011_01 = -0b1.01*2^4   = -20.0
0x0e = 0_00011_10 = +0b1.10*2^-12 = ~0.000
0x4e = 0_10011_10 = +0b1.10*2^4   = 24.0
0x8e = 1_00011_10 = -0b1.10*2^-12 = ~-0.000
0xce = 1_10011_10 = -0b1.10*2^4   = -24.0
0x0f = 0_00011_11 = +0b1.11*2^-12 = ~0.000
0x4f = 0_10011_11 = +0b1.11*2^4   = 28.0
0x8f = 1_00011_11 = -0b1.11*2^-12 = ~-0.000
0xcf = 1_10011_11 = -0b1.11*2^4   = -28.0
... ... ... ...
0x30 = 0_01100_00 = +0b1.00*2^-3  = 0.125
0x70 = 0_11100_00 = +0b1.00*2^13  = 8192.0
0xb0 = 1_01100_00 = -0b1.00*2^-3  = -0.125
0xf0 = 1_11100_00 = -0b1.00*2^13  = -8192.0
0x31 = 0_01100_01 = +0b1.01*2^-3  = 0.15625
0x71 = 0_11100_01 = +0b1.01*2^13  = 10240.0
0xb1 = 1_01100_01 = -0b1.01*2^-3  = -0.15625
0xf1 = 1_11100_01 = -0b1.01*2^13  = -10240.0
0x32 = 0_01100_10 = +0b1.10*2^-3  = 0.1875
0x72 = 0_11100_10 = +0b1.10*2^13  = 12288.0
0xb2 = 1_01100_10 = -0b1.10*2^-3  = -0.1875
0xf2 = 1_11100_10 = -0b1.10*2^13  = -12288.0
0x33 = 0_01100_11 = +0b1.11*2^-3  = 0.21875
0x73 = 0_11100_11 = +0b1.11*2^13  = 14336.0
0xb3 = 1_01100_11 = -0b1.11*2^-3  = -0.21875
0xf3 = 1_11100_11 = -0b1.11*2^13  = -14336.0
0x34 = 0_01101_00 = +0b1.00*2^-2  = 0.25
0x74 = 0_11101_00 = +0b1.00*2^14  = 16384.0
0xb4 = 1_01101_00 = -0b1.00*2^-2  = -0.25
0xf4 = 1_11101_00 = -0b1.00*2^14  = -16384.0
0x35 = 0_01101_01 = +0b1.01*2^-2  = 0.3125
0x75 = 0_11101_01 = +0b1.01*2^14  = 20480.0
0xb5 = 1_01101_01 = -0b1.01*2^-2  = -0.3125
0xf5 = 1_11101_01 = -0b1.01*2^14  = -20480.0
0x36 = 0_01101_10 = +0b1.10*2^-2  = 0.375
0x76 = 0_11101_10 = +0b1.10*2^14  = 24576.0
0xb6 = 1_01101_10 = -0b1.10*2^-2  = -0.375
0xf6 = 1_11101_10 = -0b1.10*2^14  = -24576.0
0x37 = 0_01101_11 = +0b1.11*2^-2  = 0.4375
0x77 = 0_11101_11 = +0b1.11*2^14  = 28672.0
0xb7 = 1_01101_11 = -0b1.11*2^-2  = -0.4375
0xf7 = 1_11101_11 = -0b1.11*2^14  = -28672.0
0x38 = 0_01110_00 = +0b1.00*2^-1  = 0.5
0x78 = 0_11110_00 = +0b1.00*2^15  = 32768.0
0xb8 = 1_01110_00 = -0b1.00*2^-1  = -0.5
0xf8 = 1_11110_00 = -0b1.00*2^15  = -32768.0
0x39 = 0_01110_01 = +0b1.01*2^-1  = 0.625
0x79 = 0_11110_01 = +0b1.01*2^15  = 40960.0
0xb9 = 1_01110_01 = -0b1.01*2^-1  = -0.625
0xf9 = 1_11110_01 = -0b1.01*2^15  = -40960.0
0x3a = 0_01110_10 = +0b1.10*2^-1  = 0.75
0x7a = 0_11110_10 = +0b1.10*2^15  = 49152.0
0xba = 1_01110_10 = -0b1.10*2^-1  = -0.75
0xfa = 1_11110_10 = -0b1.10*2^15  = -49152.0
0x3b = 0_01110_11 = +0b1.11*2^-1  = 0.875
0x7b = 0_11110_11 = +0b1.11*2^15  = 57344.0
0xbb = 1_01110_11 = -0b1.11*2^-1  = -0.875
0xfb = 1_11110_11 = -0b1.11*2^15  = -57344.0
0x3c = 0_01111_00 = +0b1.00*2^0   = 1.0
0x7c = 0_11111_00 = inf = inf
0xbc = 1_01111_00 = -0b1.00*2^0   = -1.0
0xfc = 1_11111_00 = -inf = -inf
0x3d = 0_01111_01 = +0b1.01*2^0   = 1.25
0x7d = 0_11111_01 = nan = nan
0xbd = 1_01111_01 = -0b1.01*2^0   = -1.25
0xfd = 1_11111_01 = nan = nan
0x3e = 0_01111_10 = +0b1.10*2^0   = 1.5
0x7e = 0_11111_10 = nan = nan
0xbe = 1_01111_10 = -0b1.10*2^0   = -1.5
0xfe = 1_11111_10 = nan = nan
0x3f = 0_01111_11 = +0b1.11*2^0   = 1.75
0x7f = 0_11111_11 = nan = nan
0xbf = 1_01111_11 = -0b1.11*2^0   = -1.75
0xff = 1_11111_11 = nan = nan
HTML(
    airdoc(
        *mktbl(
            Airium(),
            format_info_ocp_e4m3,
            skip_rows=range(0x10, 0x30),
            cols=4,
            width=8,
            d=3,
        )
    )
)
FP8 Value Table, ocp_e4m3

FP8 Value Table, ocp_e4m3

0x00 = 0_0000_000 = 0.0 = 0.0
0x40 = 0_1000_000 = +0b1.000*2^1   = 2.0
0x80 = 1_0000_000 = -0.0 = -0.0
0xc0 = 1_1000_000 = -0b1.000*2^1   = -2.0
0x01 = 0_0000_001 = +0b0.001*2^-6  = ~0.002
0x41 = 0_1000_001 = +0b1.001*2^1   = 2.25
0x81 = 1_0000_001 = -0b0.001*2^-6  = ~-0.002
0xc1 = 1_1000_001 = -0b1.001*2^1   = -2.25
0x02 = 0_0000_010 = +0b0.010*2^-6  = ~0.004
0x42 = 0_1000_010 = +0b1.010*2^1   = 2.5
0x82 = 1_0000_010 = -0b0.010*2^-6  = ~-0.004
0xc2 = 1_1000_010 = -0b1.010*2^1   = -2.5
0x03 = 0_0000_011 = +0b0.011*2^-6  = ~0.006
0x43 = 0_1000_011 = +0b1.011*2^1   = 2.75
0x83 = 1_0000_011 = -0b0.011*2^-6  = ~-0.006
0xc3 = 1_1000_011 = -0b1.011*2^1   = -2.75
0x04 = 0_0000_100 = +0b0.100*2^-6  = ~0.008
0x44 = 0_1000_100 = +0b1.100*2^1   = 3.0
0x84 = 1_0000_100 = -0b0.100*2^-6  = ~-0.008
0xc4 = 1_1000_100 = -0b1.100*2^1   = -3.0
0x05 = 0_0000_101 = +0b0.101*2^-6  = ~0.010
0x45 = 0_1000_101 = +0b1.101*2^1   = 3.25
0x85 = 1_0000_101 = -0b0.101*2^-6  = ~-0.010
0xc5 = 1_1000_101 = -0b1.101*2^1   = -3.25
0x06 = 0_0000_110 = +0b0.110*2^-6  = ~0.012
0x46 = 0_1000_110 = +0b1.110*2^1   = 3.5
0x86 = 1_0000_110 = -0b0.110*2^-6  = ~-0.012
0xc6 = 1_1000_110 = -0b1.110*2^1   = -3.5
0x07 = 0_0000_111 = +0b0.111*2^-6  = ~0.014
0x47 = 0_1000_111 = +0b1.111*2^1   = 3.75
0x87 = 1_0000_111 = -0b0.111*2^-6  = ~-0.014
0xc7 = 1_1000_111 = -0b1.111*2^1   = -3.75
0x08 = 0_0001_000 = +0b1.000*2^-6  = 0.015625
0x48 = 0_1001_000 = +0b1.000*2^2   = 4.0
0x88 = 1_0001_000 = -0b1.000*2^-6  = ~-0.016
0xc8 = 1_1001_000 = -0b1.000*2^2   = -4.0
0x09 = 0_0001_001 = +0b1.001*2^-6  = ~0.018
0x49 = 0_1001_001 = +0b1.001*2^2   = 4.5
0x89 = 1_0001_001 = -0b1.001*2^-6  = ~-0.018
0xc9 = 1_1001_001 = -0b1.001*2^2   = -4.5
0x0a = 0_0001_010 = +0b1.010*2^-6  = ~0.020
0x4a = 0_1001_010 = +0b1.010*2^2   = 5.0
0x8a = 1_0001_010 = -0b1.010*2^-6  = ~-0.020
0xca = 1_1001_010 = -0b1.010*2^2   = -5.0
0x0b = 0_0001_011 = +0b1.011*2^-6  = ~0.021
0x4b = 0_1001_011 = +0b1.011*2^2   = 5.5
0x8b = 1_0001_011 = -0b1.011*2^-6  = ~-0.021
0xcb = 1_1001_011 = -0b1.011*2^2   = -5.5
0x0c = 0_0001_100 = +0b1.100*2^-6  = ~0.023
0x4c = 0_1001_100 = +0b1.100*2^2   = 6.0
0x8c = 1_0001_100 = -0b1.100*2^-6  = ~-0.023
0xcc = 1_1001_100 = -0b1.100*2^2   = -6.0
0x0d = 0_0001_101 = +0b1.101*2^-6  = ~0.025
0x4d = 0_1001_101 = +0b1.101*2^2   = 6.5
0x8d = 1_0001_101 = -0b1.101*2^-6  = ~-0.025
0xcd = 1_1001_101 = -0b1.101*2^2   = -6.5
0x0e = 0_0001_110 = +0b1.110*2^-6  = ~0.027
0x4e = 0_1001_110 = +0b1.110*2^2   = 7.0
0x8e = 1_0001_110 = -0b1.110*2^-6  = ~-0.027
0xce = 1_1001_110 = -0b1.110*2^2   = -7.0
0x0f = 0_0001_111 = +0b1.111*2^-6  = ~0.029
0x4f = 0_1001_111 = +0b1.111*2^2   = 7.5
0x8f = 1_0001_111 = -0b1.111*2^-6  = ~-0.029
0xcf = 1_1001_111 = -0b1.111*2^2   = -7.5
... ... ... ...
0x30 = 0_0110_000 = +0b1.000*2^-1  = 0.5
0x70 = 0_1110_000 = +0b1.000*2^7   = 128.0
0xb0 = 1_0110_000 = -0b1.000*2^-1  = -0.5
0xf0 = 1_1110_000 = -0b1.000*2^7   = -128.0
0x31 = 0_0110_001 = +0b1.001*2^-1  = 0.5625
0x71 = 0_1110_001 = +0b1.001*2^7   = 144.0
0xb1 = 1_0110_001 = -0b1.001*2^-1  = -0.5625
0xf1 = 1_1110_001 = -0b1.001*2^7   = -144.0
0x32 = 0_0110_010 = +0b1.010*2^-1  = 0.625
0x72 = 0_1110_010 = +0b1.010*2^7   = 160.0
0xb2 = 1_0110_010 = -0b1.010*2^-1  = -0.625
0xf2 = 1_1110_010 = -0b1.010*2^7   = -160.0
0x33 = 0_0110_011 = +0b1.011*2^-1  = 0.6875
0x73 = 0_1110_011 = +0b1.011*2^7   = 176.0
0xb3 = 1_0110_011 = -0b1.011*2^-1  = -0.6875
0xf3 = 1_1110_011 = -0b1.011*2^7   = -176.0
0x34 = 0_0110_100 = +0b1.100*2^-1  = 0.75
0x74 = 0_1110_100 = +0b1.100*2^7   = 192.0
0xb4 = 1_0110_100 = -0b1.100*2^-1  = -0.75
0xf4 = 1_1110_100 = -0b1.100*2^7   = -192.0
0x35 = 0_0110_101 = +0b1.101*2^-1  = 0.8125
0x75 = 0_1110_101 = +0b1.101*2^7   = 208.0
0xb5 = 1_0110_101 = -0b1.101*2^-1  = -0.8125
0xf5 = 1_1110_101 = -0b1.101*2^7   = -208.0
0x36 = 0_0110_110 = +0b1.110*2^-1  = 0.875
0x76 = 0_1110_110 = +0b1.110*2^7   = 224.0
0xb6 = 1_0110_110 = -0b1.110*2^-1  = -0.875
0xf6 = 1_1110_110 = -0b1.110*2^7   = -224.0
0x37 = 0_0110_111 = +0b1.111*2^-1  = 0.9375
0x77 = 0_1110_111 = +0b1.111*2^7   = 240.0
0xb7 = 1_0110_111 = -0b1.111*2^-1  = -0.9375
0xf7 = 1_1110_111 = -0b1.111*2^7   = -240.0
0x38 = 0_0111_000 = +0b1.000*2^0   = 1.0
0x78 = 0_1111_000 = +0b1.000*2^8   = 256.0
0xb8 = 1_0111_000 = -0b1.000*2^0   = -1.0
0xf8 = 1_1111_000 = -0b1.000*2^8   = -256.0
0x39 = 0_0111_001 = +0b1.001*2^0   = 1.125
0x79 = 0_1111_001 = +0b1.001*2^8   = 288.0
0xb9 = 1_0111_001 = -0b1.001*2^0   = -1.125
0xf9 = 1_1111_001 = -0b1.001*2^8   = -288.0
0x3a = 0_0111_010 = +0b1.010*2^0   = 1.25
0x7a = 0_1111_010 = +0b1.010*2^8   = 320.0
0xba = 1_0111_010 = -0b1.010*2^0   = -1.25
0xfa = 1_1111_010 = -0b1.010*2^8   = -320.0
0x3b = 0_0111_011 = +0b1.011*2^0   = 1.375
0x7b = 0_1111_011 = +0b1.011*2^8   = 352.0
0xbb = 1_0111_011 = -0b1.011*2^0   = -1.375
0xfb = 1_1111_011 = -0b1.011*2^8   = -352.0
0x3c = 0_0111_100 = +0b1.100*2^0   = 1.5
0x7c = 0_1111_100 = +0b1.100*2^8   = 384.0
0xbc = 1_0111_100 = -0b1.100*2^0   = -1.5
0xfc = 1_1111_100 = -0b1.100*2^8   = -384.0
0x3d = 0_0111_101 = +0b1.101*2^0   = 1.625
0x7d = 0_1111_101 = +0b1.101*2^8   = 416.0
0xbd = 1_0111_101 = -0b1.101*2^0   = -1.625
0xfd = 1_1111_101 = -0b1.101*2^8   = -416.0
0x3e = 0_0111_110 = +0b1.110*2^0   = 1.75
0x7e = 0_1111_110 = +0b1.110*2^8   = 448.0
0xbe = 1_0111_110 = -0b1.110*2^0   = -1.75
0xfe = 1_1111_110 = -0b1.110*2^8   = -448.0
0x3f = 0_0111_111 = +0b1.111*2^0   = 1.875
0x7f = 0_1111_111 = nan = nan
0xbf = 1_0111_111 = -0b1.111*2^0   = -1.875
0xff = 1_1111_111 = nan = nan
HTML(
    airdoc(
        *mktbl(
            Airium(),
            format_info_ocp_e8m0,
            skip_rows=range(0x10, 0x30),
            cols=4,
            width=8,
            d=3,
        )
    )
)
FP8 Value Table, ocp_e8m0

FP8 Value Table, ocp_e8m0

0x00 = 00000000_ = +0b1.0*2^-127 = ~5.88e-39
0x40 = 01000000_ = +0b1.0*2^-63 = ~1.08e-19
0x80 = 10000000_ = +0b1.0*2^1   = 2.0
0xc0 = 11000000_ = +0b1.0*2^65  = ~3.69e+19
0x01 = 00000001_ = +0b1.0*2^-126 = ~1.18e-38
0x41 = 01000001_ = +0b1.0*2^-62 = ~2.17e-19
0x81 = 10000001_ = +0b1.0*2^2   = 4.0
0xc1 = 11000001_ = +0b1.0*2^66  = ~7.38e+19
0x02 = 00000010_ = +0b1.0*2^-125 = ~2.35e-38
0x42 = 01000010_ = +0b1.0*2^-61 = ~4.34e-19
0x82 = 10000010_ = +0b1.0*2^3   = 8.0
0xc2 = 11000010_ = +0b1.0*2^67  = ~1.48e+20
0x03 = 00000011_ = +0b1.0*2^-124 = ~4.7e-38
0x43 = 01000011_ = +0b1.0*2^-60 = ~8.67e-19
0x83 = 10000011_ = +0b1.0*2^4   = 16.0
0xc3 = 11000011_ = +0b1.0*2^68  = ~2.95e+20
0x04 = 00000100_ = +0b1.0*2^-123 = ~9.4e-38
0x44 = 01000100_ = +0b1.0*2^-59 = ~1.73e-18
0x84 = 10000100_ = +0b1.0*2^5   = 32.0
0xc4 = 11000100_ = +0b1.0*2^69  = ~5.9e+20
0x05 = 00000101_ = +0b1.0*2^-122 = ~1.88e-37
0x45 = 01000101_ = +0b1.0*2^-58 = ~3.47e-18
0x85 = 10000101_ = +0b1.0*2^6   = 64.0
0xc5 = 11000101_ = +0b1.0*2^70  = ~1.18e+21
0x06 = 00000110_ = +0b1.0*2^-121 = ~3.76e-37
0x46 = 01000110_ = +0b1.0*2^-57 = ~6.94e-18
0x86 = 10000110_ = +0b1.0*2^7   = 128.0
0xc6 = 11000110_ = +0b1.0*2^71  = ~2.36e+21
0x07 = 00000111_ = +0b1.0*2^-120 = ~7.52e-37
0x47 = 01000111_ = +0b1.0*2^-56 = ~1.39e-17
0x87 = 10000111_ = +0b1.0*2^8   = 256.0
0xc7 = 11000111_ = +0b1.0*2^72  = ~4.72e+21
0x08 = 00001000_ = +0b1.0*2^-119 = ~1.5e-36
0x48 = 01001000_ = +0b1.0*2^-55 = ~2.78e-17
0x88 = 10001000_ = +0b1.0*2^9   = 512.0
0xc8 = 11001000_ = +0b1.0*2^73  = ~9.44e+21
0x09 = 00001001_ = +0b1.0*2^-118 = ~3.01e-36
0x49 = 01001001_ = +0b1.0*2^-54 = ~5.55e-17
0x89 = 10001001_ = +0b1.0*2^10  = 1024.0
0xc9 = 11001001_ = +0b1.0*2^74  = ~1.89e+22
0x0a = 00001010_ = +0b1.0*2^-117 = ~6.02e-36
0x4a = 01001010_ = +0b1.0*2^-53 = ~1.11e-16
0x8a = 10001010_ = +0b1.0*2^11  = 2048.0
0xca = 11001010_ = +0b1.0*2^75  = ~3.78e+22
0x0b = 00001011_ = +0b1.0*2^-116 = ~1.2e-35
0x4b = 01001011_ = +0b1.0*2^-52 = ~2.22e-16
0x8b = 10001011_ = +0b1.0*2^12  = 4096.0
0xcb = 11001011_ = +0b1.0*2^76  = ~7.56e+22
0x0c = 00001100_ = +0b1.0*2^-115 = ~2.41e-35
0x4c = 01001100_ = +0b1.0*2^-51 = ~4.44e-16
0x8c = 10001100_ = +0b1.0*2^13  = 8192.0
0xcc = 11001100_ = +0b1.0*2^77  = ~1.51e+23
0x0d = 00001101_ = +0b1.0*2^-114 = ~4.81e-35
0x4d = 01001101_ = +0b1.0*2^-50 = ~8.88e-16
0x8d = 10001101_ = +0b1.0*2^14  = 16384.0
0xcd = 11001101_ = +0b1.0*2^78  = ~3.02e+23
0x0e = 00001110_ = +0b1.0*2^-113 = ~9.63e-35
0x4e = 01001110_ = +0b1.0*2^-49 = ~1.78e-15
0x8e = 10001110_ = +0b1.0*2^15  = 32768.0
0xce = 11001110_ = +0b1.0*2^79  = ~6.04e+23
0x0f = 00001111_ = +0b1.0*2^-112 = ~1.93e-34
0x4f = 01001111_ = +0b1.0*2^-48 = ~3.55e-15
0x8f = 10001111_ = +0b1.0*2^16  = 65536.0
0xcf = 11001111_ = +0b1.0*2^80  = ~1.21e+24
... ... ... ...
0x30 = 00110000_ = +0b1.0*2^-79 = ~1.65e-24
0x70 = 01110000_ = +0b1.0*2^-15 = ~3.05e-05
0xb0 = 10110000_ = +0b1.0*2^49  = ~5.63e+14
0xf0 = 11110000_ = +0b1.0*2^113 = ~1.04e+34
0x31 = 00110001_ = +0b1.0*2^-78 = ~3.31e-24
0x71 = 01110001_ = +0b1.0*2^-14 = ~6.1e-05
0xb1 = 10110001_ = +0b1.0*2^50  = ~1.13e+15
0xf1 = 11110001_ = +0b1.0*2^114 = ~2.08e+34
0x32 = 00110010_ = +0b1.0*2^-77 = ~6.62e-24
0x72 = 01110010_ = +0b1.0*2^-13 = ~0.000
0xb2 = 10110010_ = +0b1.0*2^51  = ~2.25e+15
0xf2 = 11110010_ = +0b1.0*2^115 = ~4.15e+34
0x33 = 00110011_ = +0b1.0*2^-76 = ~1.32e-23
0x73 = 01110011_ = +0b1.0*2^-12 = ~0.000
0xb3 = 10110011_ = +0b1.0*2^52  = ~4.5e+15
0xf3 = 11110011_ = +0b1.0*2^116 = ~8.31e+34
0x34 = 00110100_ = +0b1.0*2^-75 = ~2.65e-23
0x74 = 01110100_ = +0b1.0*2^-11 = ~0.000
0xb4 = 10110100_ = +0b1.0*2^53  = ~9.01e+15
0xf4 = 11110100_ = +0b1.0*2^117 = ~1.66e+35
0x35 = 00110101_ = +0b1.0*2^-74 = ~5.29e-23
0x75 = 01110101_ = +0b1.0*2^-10 = ~0.001
0xb5 = 10110101_ = +0b1.0*2^54  = ~1.8e+16
0xf5 = 11110101_ = +0b1.0*2^118 = ~3.32e+35
0x36 = 00110110_ = +0b1.0*2^-73 = ~1.06e-22
0x76 = 01110110_ = +0b1.0*2^-9  = ~0.002
0xb6 = 10110110_ = +0b1.0*2^55  = ~3.6e+16
0xf6 = 11110110_ = +0b1.0*2^119 = ~6.65e+35
0x37 = 00110111_ = +0b1.0*2^-72 = ~2.12e-22
0x77 = 01110111_ = +0b1.0*2^-8  = ~0.004
0xb7 = 10110111_ = +0b1.0*2^56  = ~7.21e+16
0xf7 = 11110111_ = +0b1.0*2^120 = ~1.33e+36
0x38 = 00111000_ = +0b1.0*2^-71 = ~4.24e-22
0x78 = 01111000_ = +0b1.0*2^-7  = ~0.008
0xb8 = 10111000_ = +0b1.0*2^57  = ~1.44e+17
0xf8 = 11111000_ = +0b1.0*2^121 = ~2.66e+36
0x39 = 00111001_ = +0b1.0*2^-70 = ~8.47e-22
0x79 = 01111001_ = +0b1.0*2^-6  = 0.015625
0xb9 = 10111001_ = +0b1.0*2^58  = ~2.88e+17
0xf9 = 11111001_ = +0b1.0*2^122 = ~5.32e+36
0x3a = 00111010_ = +0b1.0*2^-69 = ~1.69e-21
0x7a = 01111010_ = +0b1.0*2^-5  = 0.03125
0xba = 10111010_ = +0b1.0*2^59  = ~5.76e+17
0xfa = 11111010_ = +0b1.0*2^123 = ~1.06e+37
0x3b = 00111011_ = +0b1.0*2^-68 = ~3.39e-21
0x7b = 01111011_ = +0b1.0*2^-4  = 0.0625
0xbb = 10111011_ = +0b1.0*2^60  = ~1.15e+18
0xfb = 11111011_ = +0b1.0*2^124 = ~2.13e+37
0x3c = 00111100_ = +0b1.0*2^-67 = ~6.78e-21
0x7c = 01111100_ = +0b1.0*2^-3  = 0.125
0xbc = 10111100_ = +0b1.0*2^61  = ~2.31e+18
0xfc = 11111100_ = +0b1.0*2^125 = ~4.25e+37
0x3d = 00111101_ = +0b1.0*2^-66 = ~1.36e-20
0x7d = 01111101_ = +0b1.0*2^-2  = 0.25
0xbd = 10111101_ = +0b1.0*2^62  = ~4.61e+18
0xfd = 11111101_ = +0b1.0*2^126 = ~8.51e+37
0x3e = 00111110_ = +0b1.0*2^-65 = ~2.71e-20
0x7e = 01111110_ = +0b1.0*2^-1  = 0.5
0xbe = 10111110_ = +0b1.0*2^63  = ~9.22e+18
0xfe = 11111110_ = +0b1.0*2^127 = ~1.7e+38
0x3f = 00111111_ = +0b1.0*2^-64 = ~5.42e-20
0x7f = 01111111_ = +0b1.0*2^0   = 1.0
0xbf = 10111111_ = +0b1.0*2^64  = ~1.84e+19
0xff = 11111111_ = nan = nan

IEEE WG P3109 KpP formats

We choose just one example: p3109(k=8, p=3), which has the same number of exponent bits as OCP E5

HTML(
    airdoc(
        *mktbl(
            Airium(),
            format_info_p3109(8, 1, Signedness.Unsigned, Domain.Finite),
            skip_rows=range(0x10, 0x30),
            cols=4,
            width=8,
            d=3,
        )
    )
)
FP8 Value Table, p3109_k8p1uf

FP8 Value Table, p3109_k8p1uf

0x00 = 00000000_ = 0.0 = 0.0
0x40 = 01000000_ = +0b1.0*2^-64 = ~5.42e-20
0x80 = 10000000_ = +0b1.0*2^0   = 1.0
0xc0 = 11000000_ = +0b1.0*2^64  = ~1.84e+19
0x01 = 00000001_ = +0b1.0*2^-127 = ~5.88e-39
0x41 = 01000001_ = +0b1.0*2^-63 = ~1.08e-19
0x81 = 10000001_ = +0b1.0*2^1   = 2.0
0xc1 = 11000001_ = +0b1.0*2^65  = ~3.69e+19
0x02 = 00000010_ = +0b1.0*2^-126 = ~1.18e-38
0x42 = 01000010_ = +0b1.0*2^-62 = ~2.17e-19
0x82 = 10000010_ = +0b1.0*2^2   = 4.0
0xc2 = 11000010_ = +0b1.0*2^66  = ~7.38e+19
0x03 = 00000011_ = +0b1.0*2^-125 = ~2.35e-38
0x43 = 01000011_ = +0b1.0*2^-61 = ~4.34e-19
0x83 = 10000011_ = +0b1.0*2^3   = 8.0
0xc3 = 11000011_ = +0b1.0*2^67  = ~1.48e+20
0x04 = 00000100_ = +0b1.0*2^-124 = ~4.7e-38
0x44 = 01000100_ = +0b1.0*2^-60 = ~8.67e-19
0x84 = 10000100_ = +0b1.0*2^4   = 16.0
0xc4 = 11000100_ = +0b1.0*2^68  = ~2.95e+20
0x05 = 00000101_ = +0b1.0*2^-123 = ~9.4e-38
0x45 = 01000101_ = +0b1.0*2^-59 = ~1.73e-18
0x85 = 10000101_ = +0b1.0*2^5   = 32.0
0xc5 = 11000101_ = +0b1.0*2^69  = ~5.9e+20
0x06 = 00000110_ = +0b1.0*2^-122 = ~1.88e-37
0x46 = 01000110_ = +0b1.0*2^-58 = ~3.47e-18
0x86 = 10000110_ = +0b1.0*2^6   = 64.0
0xc6 = 11000110_ = +0b1.0*2^70  = ~1.18e+21
0x07 = 00000111_ = +0b1.0*2^-121 = ~3.76e-37
0x47 = 01000111_ = +0b1.0*2^-57 = ~6.94e-18
0x87 = 10000111_ = +0b1.0*2^7   = 128.0
0xc7 = 11000111_ = +0b1.0*2^71  = ~2.36e+21
0x08 = 00001000_ = +0b1.0*2^-120 = ~7.52e-37
0x48 = 01001000_ = +0b1.0*2^-56 = ~1.39e-17
0x88 = 10001000_ = +0b1.0*2^8   = 256.0
0xc8 = 11001000_ = +0b1.0*2^72  = ~4.72e+21
0x09 = 00001001_ = +0b1.0*2^-119 = ~1.5e-36
0x49 = 01001001_ = +0b1.0*2^-55 = ~2.78e-17
0x89 = 10001001_ = +0b1.0*2^9   = 512.0
0xc9 = 11001001_ = +0b1.0*2^73  = ~9.44e+21
0x0a = 00001010_ = +0b1.0*2^-118 = ~3.01e-36
0x4a = 01001010_ = +0b1.0*2^-54 = ~5.55e-17
0x8a = 10001010_ = +0b1.0*2^10  = 1024.0
0xca = 11001010_ = +0b1.0*2^74  = ~1.89e+22
0x0b = 00001011_ = +0b1.0*2^-117 = ~6.02e-36
0x4b = 01001011_ = +0b1.0*2^-53 = ~1.11e-16
0x8b = 10001011_ = +0b1.0*2^11  = 2048.0
0xcb = 11001011_ = +0b1.0*2^75  = ~3.78e+22
0x0c = 00001100_ = +0b1.0*2^-116 = ~1.2e-35
0x4c = 01001100_ = +0b1.0*2^-52 = ~2.22e-16
0x8c = 10001100_ = +0b1.0*2^12  = 4096.0
0xcc = 11001100_ = +0b1.0*2^76  = ~7.56e+22
0x0d = 00001101_ = +0b1.0*2^-115 = ~2.41e-35
0x4d = 01001101_ = +0b1.0*2^-51 = ~4.44e-16
0x8d = 10001101_ = +0b1.0*2^13  = 8192.0
0xcd = 11001101_ = +0b1.0*2^77  = ~1.51e+23
0x0e = 00001110_ = +0b1.0*2^-114 = ~4.81e-35
0x4e = 01001110_ = +0b1.0*2^-50 = ~8.88e-16
0x8e = 10001110_ = +0b1.0*2^14  = 16384.0
0xce = 11001110_ = +0b1.0*2^78  = ~3.02e+23
0x0f = 00001111_ = +0b1.0*2^-113 = ~9.63e-35
0x4f = 01001111_ = +0b1.0*2^-49 = ~1.78e-15
0x8f = 10001111_ = +0b1.0*2^15  = 32768.0
0xcf = 11001111_ = +0b1.0*2^79  = ~6.04e+23
... ... ... ...
0x30 = 00110000_ = +0b1.0*2^-80 = ~8.27e-25
0x70 = 01110000_ = +0b1.0*2^-16 = ~1.53e-05
0xb0 = 10110000_ = +0b1.0*2^48  = ~2.81e+14
0xf0 = 11110000_ = +0b1.0*2^112 = ~5.19e+33
0x31 = 00110001_ = +0b1.0*2^-79 = ~1.65e-24
0x71 = 01110001_ = +0b1.0*2^-15 = ~3.05e-05
0xb1 = 10110001_ = +0b1.0*2^49  = ~5.63e+14
0xf1 = 11110001_ = +0b1.0*2^113 = ~1.04e+34
0x32 = 00110010_ = +0b1.0*2^-78 = ~3.31e-24
0x72 = 01110010_ = +0b1.0*2^-14 = ~6.1e-05
0xb2 = 10110010_ = +0b1.0*2^50  = ~1.13e+15
0xf2 = 11110010_ = +0b1.0*2^114 = ~2.08e+34
0x33 = 00110011_ = +0b1.0*2^-77 = ~6.62e-24
0x73 = 01110011_ = +0b1.0*2^-13 = ~0.000
0xb3 = 10110011_ = +0b1.0*2^51  = ~2.25e+15
0xf3 = 11110011_ = +0b1.0*2^115 = ~4.15e+34
0x34 = 00110100_ = +0b1.0*2^-76 = ~1.32e-23
0x74 = 01110100_ = +0b1.0*2^-12 = ~0.000
0xb4 = 10110100_ = +0b1.0*2^52  = ~4.5e+15
0xf4 = 11110100_ = +0b1.0*2^116 = ~8.31e+34
0x35 = 00110101_ = +0b1.0*2^-75 = ~2.65e-23
0x75 = 01110101_ = +0b1.0*2^-11 = ~0.000
0xb5 = 10110101_ = +0b1.0*2^53  = ~9.01e+15
0xf5 = 11110101_ = +0b1.0*2^117 = ~1.66e+35
0x36 = 00110110_ = +0b1.0*2^-74 = ~5.29e-23
0x76 = 01110110_ = +0b1.0*2^-10 = ~0.001
0xb6 = 10110110_ = +0b1.0*2^54  = ~1.8e+16
0xf6 = 11110110_ = +0b1.0*2^118 = ~3.32e+35
0x37 = 00110111_ = +0b1.0*2^-73 = ~1.06e-22
0x77 = 01110111_ = +0b1.0*2^-9  = ~0.002
0xb7 = 10110111_ = +0b1.0*2^55  = ~3.6e+16
0xf7 = 11110111_ = +0b1.0*2^119 = ~6.65e+35
0x38 = 00111000_ = +0b1.0*2^-72 = ~2.12e-22
0x78 = 01111000_ = +0b1.0*2^-8  = ~0.004
0xb8 = 10111000_ = +0b1.0*2^56  = ~7.21e+16
0xf8 = 11111000_ = +0b1.0*2^120 = ~1.33e+36
0x39 = 00111001_ = +0b1.0*2^-71 = ~4.24e-22
0x79 = 01111001_ = +0b1.0*2^-7  = ~0.008
0xb9 = 10111001_ = +0b1.0*2^57  = ~1.44e+17
0xf9 = 11111001_ = +0b1.0*2^121 = ~2.66e+36
0x3a = 00111010_ = +0b1.0*2^-70 = ~8.47e-22
0x7a = 01111010_ = +0b1.0*2^-6  = 0.015625
0xba = 10111010_ = +0b1.0*2^58  = ~2.88e+17
0xfa = 11111010_ = +0b1.0*2^122 = ~5.32e+36
0x3b = 00111011_ = +0b1.0*2^-69 = ~1.69e-21
0x7b = 01111011_ = +0b1.0*2^-5  = 0.03125
0xbb = 10111011_ = +0b1.0*2^59  = ~5.76e+17
0xfb = 11111011_ = +0b1.0*2^123 = ~1.06e+37
0x3c = 00111100_ = +0b1.0*2^-68 = ~3.39e-21
0x7c = 01111100_ = +0b1.0*2^-4  = 0.0625
0xbc = 10111100_ = +0b1.0*2^60  = ~1.15e+18
0xfc = 11111100_ = +0b1.0*2^124 = ~2.13e+37
0x3d = 00111101_ = +0b1.0*2^-67 = ~6.78e-21
0x7d = 01111101_ = +0b1.0*2^-3  = 0.125
0xbd = 10111101_ = +0b1.0*2^61  = ~2.31e+18
0xfd = 11111101_ = +0b1.0*2^125 = ~4.25e+37
0x3e = 00111110_ = +0b1.0*2^-66 = ~1.36e-20
0x7e = 01111110_ = +0b1.0*2^-2  = 0.25
0xbe = 10111110_ = +0b1.0*2^62  = ~4.61e+18
0xfe = 11111110_ = +0b1.0*2^126 = ~8.51e+37
0x3f = 00111111_ = +0b1.0*2^-65 = ~2.71e-20
0x7f = 01111111_ = +0b1.0*2^-1  = 0.5
0xbf = 10111111_ = +0b1.0*2^63  = ~9.22e+18
0xff = 11111111_ = nan = nan

Some tiny tiny formats

And finally, some tiny tiny formats. We will take a finite P3109 format.

For p=1, we get as usual, a pure-exponential format with range 2^-1 to 2^1:

p3109_3p1f = format_info_p3109(3, 1, Signedness.Signed, Domain.Finite)
HTML(airdoc(*mktbl(Airium(), p3109_3p1f, cols=2, width=8, d=3)))
FP3 Value Table, p3109_k3p1sf

FP3 Value Table, p3109_k3p1sf

0x00 = 0_00_ = 0.0 = 0.0
0x04 = 1_00_ = nan = nan
0x01 = 0_01_ = +0b1.0*2^-1  = 0.5
0x05 = 1_01_ = -0b1.0*2^-1  = -0.5
0x02 = 0_10_ = +0b1.0*2^0   = 1.0
0x06 = 1_10_ = -0b1.0*2^0   = -1.0
0x03 = 0_11_ = +0b1.0*2^1   = 2.0
0x07 = 1_11_ = -0b1.0*2^1   = -2.0

And for p=2, we get, as usual for p=k-1, a purely linear format. In this case, with values (0.5, 1.0, 1.5). Again as usual, 1.0 is in the middle of the range.

p3109_3p1f = format_info_p3109(3, 2, Signedness.Signed, Domain.Finite)
HTML(airdoc(*mktbl(Airium(), p3109_3p1f, cols=2, width=8, d=3)))
FP3 Value Table, p3109_k3p2sf

FP3 Value Table, p3109_k3p2sf

0x00 = 0_0_0 = 0.0 = 0.0
0x04 = 1_0_0 = nan = nan
0x01 = 0_0_1 = +0b0.1*2^0   = 0.5
0x05 = 1_0_1 = -0b0.1*2^0   = -0.5
0x02 = 0_1_0 = +0b1.0*2^0   = 1.0
0x06 = 1_1_0 = -0b1.0*2^0   = -1.0
0x03 = 0_1_1 = +0b1.1*2^0   = 1.5
0x07 = 1_1_1 = -0b1.1*2^0   = -1.5