MCPcopy
hub / github.com/mum4k/termdash / appendRollingFloat

Function appendRollingFloat

termdashdemo/termdashdemo.go:200–206  ·  view source on GitHub ↗

appendRollingFloat appends v and trims the slice to max length.

(vals []float64, v float64, max int)

Source from the content-addressed store, hash-verified

198
199// appendRollingFloat appends v and trims the slice to max length.
200func 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].
209func clampInt(v, lo, hi int) int {

Callers 2

animateVisualizeFunction · 0.70
animateExplorerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected