10 lines
165 B
Python
10 lines
165 B
Python
def kahan_sum(x):
|
|
total = 0.0
|
|
c = 0.0
|
|
for v in x:
|
|
y = v - c
|
|
t = total + y
|
|
c = (t - total) - y
|
|
total = t
|
|
return total
|