Files
pplus-library/modules/numerics/kahan-sum/ref/mojo/plain.mojo
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

10 lines
240 B
Mojo

def kahan_sum(x: List[Float64]) -> Float64:
var total: Float64 = 0.0
var c: Float64 = 0.0
for i in range(len(x)):
var y = x[i] - c
var t = total + y
c = (t - total) - y
total = t
return total