binByBoundaries function
Assign each value in values to a bin using ascending boundaries.
A value goes to the index of the first boundary it does not exceed
(upper-bound search): values <= boundaries[0] go to bin 0, and values
greater than every boundary go to bin boundaries.length. Result indices
are in 0..boundaries.length.
Audited: 2026-06-12 11:26 EDT
Implementation
List<int> binByBoundaries(List<num> values, List<num> boundaries) =>
values.map((num v) => _upperBoundBin(v.toDouble(), boundaries)).toList();