MCPcopy
hub / github.com/grafana/tempo / kahanSumInc

Function kahanSumInc

pkg/traceql/util.go:211–224  ·  view source on GitHub ↗
(inc, sum, c float64)

Source from the content-addressed store, hash-verified

209}
210
211func kahanSumInc(inc, sum, c float64) (newSum, newC float64) {
212 t := sum + inc
213 switch {
214 case math.IsInf(t, 0):
215 c = 0
216
217 // Using Neumaier improvement, swap if next term larger than sum.
218 case math.Abs(sum) >= math.Abs(inc):
219 c += (sum - t) + inc
220 default:
221 c += (inc - t) + sum
222 }
223 return t, c
224}

Callers 2

addMethod · 0.85
sumOverTimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected