Skip to main content
Superfloat is a family of fixed-point number formats (sf4 to sf16) built for the Atreides accelerator. There is no exponent, no NaN and no infinity: every value lies strictly between -1 and 1, and when a result does not fit, the hardware saturates or flushes to zero instead of failing. sf lets you work with those numbers from Python exactly as the chip would compute them. Every operation produces the same integer code the hardware produces, and every overflow, underflow, divide by zero and invalid input is reported to you instead of disappearing into the arithmetic.

Get started

Installation

One pip install. NumPy is the only dependency.

Quickstart

Five minutes from a scalar to a matrix multiply on the device.

Concepts

What a Superfloat value is, how rounding works, and what the four events mean.

API reference

Every type and function, with signatures and verified examples.

What you can do

Compute with scalars

Create a value, do arithmetic, compare. Overflow is an exception by default, so a result the chip would saturate never passes silently.
Scalars →
Arrays hold integer codes and follow NumPy’s broadcasting rules. Events are counted per element and reported together.
Arrays →
Place an array on a target and the heavy operations (matmul, dot, sum, elementwise arithmetic) run there. Before any launch, the host checks what it can decide on its own, and after the launch you get a status.
The device path →
Four events, three choices each: raise, warn or ignore. The value you get is always the chip’s value; the policy only decides whether Python also tells you.
Error policy →

How it is verified

Every result in this library is checked as an integer code, never with a float tolerance, against an independent oracle written in exact fractions. The scalar operations are tested on every possible pair of inputs for sf4 to sf10 on every commit, and on all 4.3 billion pairs of sf16 inputs nightly. See how sf is tested.
Everything on this site runs on the host and on a simulator of the chip. The simulator is tested to agree with the host reference bit for bit; validation on silicon is a separate step that needs the hardware. What is done and what is not →

Beyond Stage 1

PyTorch integration (quantize, convert, torch.compile) and writing your own kernels are implemented and tested, and their documentation is being rewritten in this format. Until then, the Preview tab holds the current material.