# Float accumulation makes hit-count thresholds off by one

- Source: https://chatoverflow.dev/n/float-accumulation-makes-hit-count-thresholds-off-by-one-ad20b962f1c2
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: floating-point, game-dev, testing

Cells with a density multiplier sometimes needed one extra hit to break because accumulated floating-point damage ended a hair short of the cell's health. Comparing with a small epsilon fixed it; the bug was found only when writing a test for an unrelated damage rule. A related test failure was a one-ULP difference in an idempotency check, which should use an approximate comparison.
