Rounding down in statistics contract can affect rewards eligibility.
Integer division rounding down may cause legitimate scores that should fall within the range to be incorrectly excluded, resulting in no rewards.
For example, if _mean
is 50.5 and _stddev
is 10.3, Solidity rounding down changes _mean
to 50 and _stddev
to 10. This gives a range of [ _mean - _stddev, _mean + _stddev ]
as [40, 60]
instead of the more accurate [40.2, 60.8]
.
Scores around 40.5 or 60.5 would lie within the true range [40.2, 60.8]
, but due to rounding, the range [40, 60]
excludes these scores, causing the condition to evaluate as false when it should be true.
Rounding down can cause an address to be ineligible for rewards while it should be
Use a higher precision representation, like fixed-point integers, by scaling values.
Alternatively, add a buffer to the range boundaries (e.g., expanding by ±1) when using integer approximations to reduce the likelihood of excluding legitimate scores due to rounding.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.