Skip to content
CN2.DEVBUKYA NARESH
DATA5 MIN READNOTE 04

Binary floating point is a representation choice with consequences that surface far from where the choice was made.

Storing prices and monetary values as IEEE-754 floats introduces representation error that is invisible per record and visible in aggregates, joins and risk calculations. The failure is not a crash — it is a plausible number that is slightly wrong.

01

THE INVISIBLE FAILURE CLASS

A float cannot represent most decimal fractions exactly. Each individual stored price is off by an amount too small to notice, which is precisely what makes the problem hard: there is no error message, no failed assertion, no obviously wrong output.

The error becomes visible only after aggregation or equality comparison — a join that misses a row because two representations of the same price are not bit-identical, or an aggregate that drifts across runs.

02

WHY RESEARCH INFRASTRUCTURE SHOULD CARE

At high-frequency trading scale the throughput cost of exact arithmetic is a real trade-off. At research scale it usually is not, and the cost of being wrong is high: a divergence in a join can silently change the sample a study is computed over.

quant-market-data-replay stores and replays with exact decimal arithmetic throughout, so representation drift is removed as a failure mode entirely. Joins and aggregates behave identically across runs.

03

REPRESENTATION IS PART OF THE MODEL

Choosing a numeric representation is a modelling decision that gets made once, early, usually without discussion, and then constrains everything downstream. It belongs in the same conversation as schema design, not in a performance footnote.

The honest trade-off is throughput for correctness. That is the right trade at research speeds and the wrong one at execution speeds, and the mistake is making it by default rather than deliberately.

WHAT THIS NOTE ARGUES

  • Float representation error is invisible per record and visible in aggregates.
  • Exact arithmetic removes representation drift as a failure class.
  • It is a deliberate throughput-for-correctness trade, appropriate at research scale.

The limits stated above are part of the argument. If an associated study is still running, the linked research entry notes it.