     ret = _.min(indices(arr), ((i) -> return arr[i]))
     return ret
 
-  # FIXME Optimize this.
-  bisect_right = (xs, x) ->
-    for i in [0..xs.length]
-      if xs[i] > x
-        return i
-    return xs.length
-
   clamp = (x, min_val, max_val) ->
     return Math.max(min_val, Math.min(max_val, x))
 

      ideal_mantissa = ideal_interval / ideal_magnitude

      # An untested optimization.
#       index = bisect_right(@allowed_mantissas, ideal_mantissa)
#       candidate_mantissas = @allowed_mantissas[index..index + 1]
      candidate_mantissas = @allowed_mantissas


      data_range = data_high - data_low
      ideal_interval = @get_ideal_interval(data_low, data_high)
      scale_ndxs = [
        _.sortedIndex(@min_intervals, ideal_interval) - 1,
        _.sortedIndex(@max_intervals, ideal_interval)
      ]
      intervals = [@min_intervals[scale_ndxs[0]],
                   @max_intervals[scale_ndxs[1]]]
