open source · MIT / Apache-2.0

df64

Double-double arithmetic on f32 pairs.
~48-bit precision on GPUs and WASM without native f64.

$ curl -sSf https://df64.jesed.dev/install.sh | sh
$ df64 bench
dd_add     3750 Mop/s
gemm 64×64  8.0 Gflop/s (ddf)
$ df64 verify
passed 4000/4000  worst err 8.2e-15

Why df64

No native f64? No problem.

Consumer GPUs, mobile hardware, and WebGPU/WASM only expose fast single precision. df64 gets you double-precision-grade numbers from f32 hardware — roughly 48 significant bits, not 24.

Vendor-agnostic

One WGSL source, any GPU. Same math text runs on NVIDIA, AMD, Intel, Metal, DX12, and WebGPU. Bitwise-identical results by construction.

Verified against 128-bit

Every scalar kernel is checked against a GMP/MPFR 128-bit oracle with a deterministic seed. Errors gated at 2−44 (operand-scaled) and 2−46 (result-scaled).

Battle-tested kernels

axpy, dot, gemm, SpMV, conjugate gradient — all reimplemented over the double-double scalar with fma-accurate accumulation.

36 KB WASM

The entire bridge — scalar ops, linalg, CG solver, GEMM — compiles to 36 KB of WebAssembly. Runs in any browser, any runtime.

CPU fallback always works

No GPU required. The CPU path gives the same numbers as the GPU path. Correctness is never gated on hardware you don't have.

How it works

Every value is stored as the unevaluated sum of two f32 words:

x ≈ hi + lo        (hi, lo both f32)

hi is the correctly-rounded leading word (24 bits). lo captures the remainder (24 more bits). Together they give ≈ 48 significant bits — 2−48 ≈ 3.6 × 10−15 per operation.

The engine is three error-free transformations from Dekker (1971):

twoSum(a, b):    s = a + b;  e = (a - (s - b)) + (b - (s - a))
                 a + b = s + e  (exact, no rounding)

split(a):        t = 4097·a;  hi = t - (t - a);  lo = a - hi

twoProd(a, b):   p = a·b;  e = fma(a, b, -p)  (exact error via FMA)

These give dd_add, dd_mul, dd_div, dd_sqrt — each a single correctly-rounded kernel. The same text ships as WGSL for the GPU path.

Install

curl
cargo
wasm
curl -sSf https://df64.jesed.dev/install.sh | sh

Builds from source via Cargo. Requires Rust toolchain.

cargo install df64-cli --git https://github.com/jesedv/df64.git

Installs the df64 binary to ~/.cargo/bin.

wasm-pack build crates/df64-wasm --target web --out-dir ../../ui/pkg
cd ui && npm install && npm run dev

Builds the WASM bridge and starts the local dev server.