()
| 3 | import "math" |
| 4 | |
| 5 | func sumOverTime() func(curr float64, n float64) (res float64) { |
| 6 | var comp float64 // Kahan compensation |
| 7 | return func(sum, inc float64) (res float64) { |
| 8 | if math.IsNaN(sum) { |
| 9 | return inc |
| 10 | } |
| 11 | y := inc - comp |
| 12 | sum, c := kahanSumInc(y, sum, 0) // Compensation is applied on every step, hence we pass 0 to reset it |
| 13 | comp = c |
| 14 | return sum |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | func minOverTime() func(curr float64, n float64) (res float64) { |
| 19 | return func(curr, n float64) (res float64) { |
no test coverage detected