def naive_covariance(data1, data2):
    """Fast but prone to catastrophic cancellaion when
    E[XY] ~ E[X]E[Y] i.e. the numbers are small and
    not negligible to the computer precision limit"""
    n = len(data1)
    sum12 = 0
    sum1 = sum(data1)
    sum2 = sum(data2)
    for i1, i2 in zip(data1, data2):
        sum12 += i1 * i2
    covariance = (sum12 - sum1 * sum2 / n) / (n - 1)
    return covariance
