The quadratic deviation qd can be very large, causing the
multiplication n * qd to overflow. The new code avoids the
multiplication at the cost of two calls to int_sqrt() instead of one.
{
if (!n || !qd)
return 0;
{
if (!n || !qd)
return 0;
- return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd);
+ return 100 * (n * x - sum) / (int64_t)int_sqrt(n) / (int64_t)int_sqrt(qd);
}
static long compute_num_played_score(struct afs_info *afsi)
}
static long compute_num_played_score(struct afs_info *afsi)