def harmonic_sum(n):
    total = 0.0
    for i in range(1, n):
        total += 1 / i
    return total