Home » Expert Explains Why Same Database Query Can Return Different Totals

Why The Same Numbers Can Sum Differently On Parallel Computers

By

–

Data Center Server Racks

Add three numbers by hand and the order does not matter. Ask a computer, and it can. That quiet surprise sits beneath a mid-June 2026 paper and the open-source library that came with it, and its consequences reach closer to home than most people assume: every time a bank, a pension fund or an insurer totals a huge column of figures, the machine doing the adding may return a different answer depending on the order it worked in.

The Order That Changes The Total

The culprit is the IEEE 754 floating-point standard nearly every processor follows. Because each addition gets rounded to finite precision, (a + b) + c does not always equal a + (b + c) once fractions are involved. A single-threaded program hides this — the compiler fixes one addition order and sticks to it. Spread the same sum across many cores or onto a GPU, and the order now depends on how work is chunked, when atomic commits land, kernel heuristics and the scheduler. Change nothing but the schedule, and the total moves.

The paper makes that concrete. In one experiment, a portfolio-risk reduction over 100,000 risk contributions — mixed signs, magnitudes log-normal and spread over 12 orders of scale — produced 8 distinct floating-point answers with nothing altered except the schedule that accumulated blocks. The gap between smallest and largest ran about 6.5 units in the last place on a base number in the hundreds of billions. A deterministic tree reduction, run over the same input, produced a single value, bit-identical across every schedule and run.

A Floor Under The Sum

The response is mojo-deterministic, a compact open-source companion built for financial AI and written in Mojo, a Python-like systems language that compiles through an MLIR pipeline. Its public surface is deliberately narrow: deterministic versions of the trio summation, dot product and risk aggregation, each guaranteed to return identical bits whatever the thread count and however the input is chunked. Inside, the design runs in four stages — partition the input by index range, let each worker reduce its block in a fixed sequential order, write the partial results into dedicated slots, then combine those partials in a fixed index-based order. Atomic accumulation is avoided on purpose, because atomics would hand the final ordering back to the scheduler.

Verification is bit-level, not approximate. Given an ill-conditioned input of 50,000 elements, the deterministic kernels matched an exact rational-arithmetic reference, while a naive parallel reduction of the same numbers produced 10 different floating-point results. The price of determinism stays local: a per-kernel overhead attached to each operation, far lighter than flipping PyTorch’s global deterministic switch, which typically craters throughput and can make unsupported operators error out outright.

Fast And Checkable At Once

Speed was not surrendered to get there. In Monte Carlo option-pricing benchmarks on Apple Silicon, a pure Python loop over 1M paths took 291.3 ms, NumPy vectorization 16.6 ms, Mojo serial 54.8 ms and Mojo’s parallel version 11.9 ms — 24.6 times faster than the Python loop. For communities and families across the region, that pairing is the point. Regulated finance does not get to choose between fast and checkable: backtests evolve recursively through time, so a perturbation at the last decimal place can steer a future decision path, and what a regulator demands is exact reconciliation from recorded inputs and code, not answers that merely agree most of the time.

The library is honest about its limits. It targets scalar, SIMD and multicore CPU execution today, with the same principles meant to stretch to GPUs as Mojo’s GPU stack matures, and it tackles drift at the reduction level rather than every source of numerical wobble. The old assumption — that computers do arithmetic the way people do — is the real trap. What the mid-June work offers is not a magic fix but something more useful for the people who depend on these numbers: one place where the floor is solid, and the total comes out the same every single time.

Sources

Get breaking stories first on our Telegram channel.

More stories by

Most read

Electronics & Computing

Cybersecurity

Gadgets & Reviews

Business