Precision Loss / Rounding Errors

Security · Deep

A vulnerability in Solana programs where integer division truncation causes systematic under- or over-accounting of token amounts, compoundable over many transactions into significant value extraction. Since Solana programs use integer arithmetic exclusively (no floating point), every division discards remainders. Defenses include ceiling division for payouts, floor division for deposits, and scaling values by large factors (e.g., 1e9) before dividing to minimize relative truncation error.

Related terms