It's NOT OK to compare floating-points using epsilons

April 14, 2026
A young woman expressing frustration while using a laptop at home.
Photo by Helena Lopes on Pexels

Clickbait with a point

A new blog post argues — intentionally provocatively — that the common mantra “always compare floats with an epsilon” is more often harmful than helpful. It has been reported that the author, drawing on 15+ years working with geometry, graphics and simulations, found only a handful of cases where epsilon-based comparisons were actually the best fix. More often, the claim goes, those tiny thresholds are band‑aids that hide deeper design problems and introduce subtle bugs.

Floating point: deterministic, not mystical

The post pushes back on the idea that floating-point arithmetic is some capricious black box. Floating operations are deterministic and standardized: each operation rounds to the nearest representable value (with defined tie-breaking), so results are predictable even if not exact. That predictability means the right answer is usually to rethink the math, the algorithm, or the representation — not to slap an arbitrary 1e‑6 on a comparison. Yes, floats aren’t associative; small differences crop up (the author points to 32‑bit examples with ~6e‑8 gaps). But predictable ≠ random.

Epsilons often paper over real problems

It has been reported that the post lists several practical weaknesses of epsilon comparisons: choosing an epsilon is arbitrary and context‑dependent, different parts of code can use different distance metrics and break transitivity, and epsilons tend to hide design faults rather than fix them. The suggested alternative? Rework the code: use exact representations where possible, compare values at the right stage of computation, or adopt domain‑specific predicates instead of a one‑size‑fits‑all threshold. In short: before you reach for an epsilon, ask — am I treating a symptom or curing the disease?

Sources: lisyarus.github.io, Lobsters