appendRollingFloat appends v and trims the slice to max length.
(vals []float64, v float64, max int)
| 198 | |
| 199 | // appendRollingFloat appends v and trims the slice to max length. |
| 200 | func appendRollingFloat(vals []float64, v float64, max int) []float64 { |
| 201 | vals = append(vals, v) |
| 202 | if len(vals) > max { |
| 203 | vals = vals[len(vals)-max:] |
| 204 | } |
| 205 | return vals |
| 206 | } |
| 207 | |
| 208 | // clampInt constrains v to [lo, hi]. |
| 209 | func clampInt(v, lo, hi int) int { |
no outgoing calls
no test coverage detected