Range returns the minimum and maximum values.
(vs Valuer)
| 67 | |
| 68 | // Range returns the minimum and maximum values. |
| 69 | func Range(vs Valuer) (min, max float32) { |
| 70 | min = math32.Inf(1) |
| 71 | max = math32.Inf(-1) |
| 72 | for i := 0; i < vs.Len(); i++ { |
| 73 | v := vs.Value(i) |
| 74 | if math32.IsNaN(v) { |
| 75 | continue |
| 76 | } |
| 77 | min = math32.Min(min, v) |
| 78 | max = math32.Max(max, v) |
| 79 | } |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | // Values implements the Valuer interface. |
| 84 | type Values []float32 |