According to plink documentation, a hardcall is saved when the distance from the nearest hardcall, defined as **0.5 * sum_i |x_i - round(x_i)|** (where the x_i's are 0..2 allele dosages), is not greater than 0.1. 

Truthfully, this doesn't make sense to me (especially why x_i is being summed) and was hoping if someone could help break down math.

Many thanks!
Suppose there are three alleles, with dosages 1.01, 0.92, and 0.07.  Then the formula yields:

      0.5 * (|1.01 - 1| + |0.92 - 1| + |0.07 - 0|)
    = 0.5 * (0.01 + 0.08 + 0.07)
    = 0.5 * 0.16
    = 0.08

which is not greater than 0.1, so the nearest hardcall (one copy of the first allele and one copy of the second allele) is saved.

The formula is a little bit complicated because it has to generalize to multiallelic variants.  It does exactly what you’d expect when there are only two alleles, though.