Microfloats is a Julia package that implements types and arithmetic (through wider intermediates) for sub-byte floating points, supporting arbitrary combinations of sign, exponent, and significand (mantissa) bits.
In ordinary arrays, or as single instances, sub-8 bit floating points are one byte wide; Microfloats provides a numerical reference for any conceivable microfloat, but also offers canonical types for common narrow data formats which can then be used downstream by packages like cuTile.jl.
Define your own microfloat with the macro:
using Microfloats: @microfloat
@microfloat Float8_E5M2 sign=1 exponent=5 significand=2 nonfinite=Microfloats.IEEEor find predefined types in the documentation.
using Pkg
Pkg.add("Microfloats")