Computing Library › Glossary
Glossary

Floating-Point Error

The inaccuracy introduced when real numbers are stored and computed with finite precision.

Definition

Floating-point error is the discrepancy between exact real arithmetic and the finite-precision floating-point arithmetic computers actually perform. Each operation rounds to the nearest representable value, and these tiny errors can accumulate.

Summing many numbers is a classic case where naive order loses accuracy; compensated summation, such as Kahan's algorithm, recovers lost low-order bits. Being aware of which operations lose precision lets a programmer reorder or reformulate to preserve it.

The order of operations matters because floating-point addition is not associative, so summing many numbers naively can lose accuracy that compensated-summation algorithms recover. Catastrophic cancellation, subtracting nearly equal quantities, can wipe out significant digits in a single step. Awareness of these failure modes lets a programmer reformulate expressions to preserve precision, which is often the difference between a stable computation and one that silently produces nonsense.

Failure modes

Why it matters

Floating-point error can silently corrupt results, and it interacts with an ill-conditioned problem's condition number to magnify inaccuracy. Awareness of it is essential for writing reliable numerical code and for reproducible results.

Fusion connection

Kronos runs simulations in double precision and tracks numerical error because plasma quantities span many orders of magnitude, where careless arithmetic could distort a physical result.