In-depth lesson · Rounding and precision errors
Root causes
Every point the Rounding and precision errors reports back under this heading, best-backed first, each with the reports it is seen in.
-
Rounding in the wrong direction or inconsistently between functions.
Seen in 13 reports
-
Share price set by the first depositor without a virtual offset or minimum liquidity.
Seen in 10 reports
-
Casting or truncating integers between widths or precisions without bounds checks.
Seen in 3 reports
-
Dividing before multiplying so intermediate values truncate to zero or lose precision.
-
Precision constants or scaling factors that are too small for the value range.
Seen in 1 report
-
Assuming a fixed number of decimals or precision that low-decimal tokens do not have.
Seen in 1 report