(inc, sum, c float64)
| 209 | } |
| 210 | |
| 211 | func 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 | } |
no outgoing calls
no test coverage detected