04 / QUANTITATIVE FINANCE, PHYSICS & CAD · Quant Researchers, Physicists & Simulation Engineers

True 64-Bit Scientific & Financial Precision on Mac GPUs

Apple Silicon GPUs execute standard shaders in 32-bit (~6.5–7 digits of accuracy). xFermat recovers full IEEE double-precision accuracy (0.0 relative error via 150-bit Garner CRT) directly inside all-GPU Metal pipelines—and honestly routes back to CPU BLAS unless exact GPU residency is requested.

VERIFIED BENCHMARK RESULT
150-Bit Garner CRT
0.0 GPU Rel Err (p=25..45 & κ=1e12 Sliced) · 11.9× / 67× GPU vs FP32 tradeoff
Full 64-bit GPU accuracy · Zero drift on ill-conditioned math
THE BOTTLENECK

Why standard 32-bit Mac GPU math silently breaks stiff simulations

Standard Metal compute shaders retain only ~6.5–7 decimal digits (5.74e-7 error on 1024² IID; collapsing to 1723.2 relative error at 0.94 ms on ill-conditioned κ=1e12 512×512), ruining covariance inversions, orbital/PDE time steps, and stiff solvers.

HOW XFERMAT FIXES IT

150-bit Ozaki Scheme II Garner CRT + GPU mantissa slicing on Metal

CRTModularGEMM partitions FP64 inputs across 24 pairwise-coprime moduli (packed into 3×50-bit Garner limbs) and 11-modulus GPU slicing inside Metal—hitting 0.0 relative error for p=25..45, 1.07e-15 on 1024² IID, and 0.0 vs 50-digit exact on κ=1e12. Because Ozaki-2 runs in 11.19 ms (Sliced 63.32 ms) vs 0.76 ms CPU BLAS on 512², FermatEngine(mode="auto") honestly routes to CPU unless you explicitly request mode="crt_fp64" or "crt_sliced_fp64" inside GPU-resident graphs.

How it works step-by-step
32-BIT GPU DRIFT

Catastrophic 1723.2 error on κ=1e12 ill-conditioned matrices

While FP32 Metal GEMM finishes 512×512 in 0.94 ms (3.64 ms at 1024²), losing lower mantissa bits causes 5.74e-7 IID drift and complete cancellation on κ=1e12 inputs.

150-BIT GARNER CRT RECONSTRUCTION

24 pairwise-coprime moduli + 11-modulus GPU slicing

Performs error-free mantissa slicing on Metal and reassembles full IEEE double-precision results with signed 150-bit Garner accumulators (0.0 rel err across p=25..45).

HONEST DISPATCH POLICY

Opt-in GPU exactness—zero hidden latency surprises

mode="auto" prefers fast CPU BLAS when host memory is fine; pass mode="crt_fp64" (or CRTModularGEMM) whenever tensors must stay GPU-resident.

Runnable Python quickstart (exact-simulation.py)
RUNNABLE PYTHON QUICKSTART

Exact 150-bit CRT-Ozaki II double-precision GPU matmul

Included in the free PyPI Open Runtime (pip install xfermat).

xFermat quickstart (exact-simulation.py)
import numpy as np
from fermat import CRTModularGEMM

gemm = CRTModularGEMM(backend="gpu_150bit")
rng = np.random.default_rng(7)
A = rng.standard_normal((512, 512), dtype=np.float64)
B = rng.standard_normal((512, 512), dtype=np.float64)

C_exact = gemm.matmul(A, B, scheme="ozaki2")
rel_err = np.linalg.norm(C_exact - (A @ B)) / np.linalg.norm(A @ B)
print(f"GPU CRT relative error vs exact FP64: {rel_err:.2e}")
MORE USE CASES

Explore other workflows

All solutions →
OPEN RUNTIME & COMMERCIAL LICENSING

Start with pip install "xfermat[llm]" or book a fleet pilot

Evaluate free on 1 personal Mac via PyPI Open Runtime, or unlock Pro commercial bundling (€39/seat) and Enterprise air-gapped MDM fleets (from €750/mo).