// Min returns the minimum value in a collection of values.
496306
func (q Query) Min() (r interface{}) {
	next := q.Iterate()
	item, ok := next()
	if !ok {
		return nil
	}

	compare := getComparer(item)
	r = item

	for item, ok := next(); ok; item, ok = next() {
		if compare(item, r) < 0 {
			r = item
		}
	}

	return
}
1353609
func Min(input Float64Data) (min float64, err error) {

	// Get the count of numbers in the slice
	l := input.Len()

	// Return an error if there are no numbers
	if l == 0 {
		return math.NaN(), EmptyInputErr
	}

	// Get the first value as the starting point
	min = input.Get(0)

	// Iterate until done checking for a lower value
	for i := 1; i < l; i++ {
		if input.Get(i) < min {
			min = input.Get(i)
		}
	}
	return min, nil
}
427290
func getMinValue(values []uint64) uint64 {
	result := uint64(math.MaxUint64)
	for _, value := range values {
		if value < result {
			result = value
		}
	}
	return result
}
600453
func MinByteCount(a, b protocol.ByteCount) protocol.ByteCount {
	if a < b {
		return a
	}
	return b
}
1364155
func Min(v1, v2 Value) (Value, error) {
	return minmax(v1, v2, true)
}
367674
func (s *SearchSource) MinScore(minScore float64) *SearchSource {
	s.minScore = &minScore
	return s
}
1097558
func (i Interval) Less(other Interval) bool {
	return i.latest.Sub(other.earliest) < 0
}
480892
func MinMax(min, max time.Time) (time.Time, time.Time) {
	if IsGreaterThan(min, max, false) {
		return max, min
	}
	return min, max
}
707716
func Min(x, y float32) float32 {
	return float32(math.Min(float64(x), float64(y)))
}
946343
func (p *PostGISPolygon) Min() PostGISPoint {
	if len(p.Points) != 5 || p.Points[0] != p.Points[4] ||
		p.Points[0].Lon != p.Points[1].Lon || p.Points[0].Lat != p.Points[3].Lat ||
		p.Points[1].Lat != p.Points[2].Lat || p.Points[2].Lon != p.Points[3].Lon {
		panic("Not an envelope polygon")
	}

	return p.Points[0]
}
260209
func (q *TermRangeQuery) Min(min string, inclusive bool) *TermRangeQuery {
	q.options["min"] = min
	q.options["inclusive_min"] = inclusive
	return q
}
1132231
func (as ArraySpec) Min(val Input) Input {
	return as.proc(func(i Input) Input {
		return i.Min(val)
	})
}
171189
func (h *Histogram) Min() int64 {
	var min int64
	i := h.iterator()
	for i.next() {
		if i.countAtIdx != 0 && min == 0 {
			min = i.highestEquivalentValue
			break
		}
	}
	return h.lowestEquivalentValue(min)
}
1086563
func minFloat64(x float64, others ...float64) float64 {
	min := x
	for _, y := range others {
		if y < min {
			min = y
		}
	}
	return min
}
886102
func Minimum(val interface{}) {
	if a, ok := attributeDefinition(); ok {
		if a.Type != nil && a.Type.Kind() != design.IntegerKind && a.Type.Kind() != design.NumberKind {
			incompatibleAttributeType("minimum", a.Type.Name(), "an integer or a number")
		} else {
			var f float64
			switch v := val.(type) {
			case float32, float64, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64:
				f = reflect.ValueOf(v).Convert(reflect.TypeOf(float64(0.0))).Float()
			case string:
				var err error
				f, err = strconv.ParseFloat(v, 64)
				if err != nil {
					dslengine.ReportError("invalid number value %#v", v)
					return
				}
			default:
				dslengine.ReportError("invalid number value %#v", v)
				return
			}
			if a.Validation == nil {
				a.Validation = &dslengine.ValidationDefinition{}
			}
			a.Validation.Minimum = &f
		}
	}
}
557332
func (h *PCPHistogram) Min() int64 {
	h.mutex.RLock()
	defer h.mutex.RUnlock()
	return int64(h.vals["min"].val.(float64))
}
208254
func (f *fragment) min(filter *Row, bitDepth uint) (min, count uint64, err error) {

	consider := f.row(uint64(bitDepth))
	if filter != nil {
		consider = consider.Intersect(filter)
	}

	// If there are no columns to consider, return early.
	if consider.Count() == 0 {
		return 0, 0, nil
	}

	for i := bitDepth; i > uint(0); i-- {
		ii := i - 1 // allow for uint range: (bitDepth-1) to 0
		row := f.row(uint64(ii))

		x := consider.Difference(row)
		count = x.Count()
		if count > 0 {
			consider = x
		} else {
			min += (1 << ii)
			if ii == 0 {
				count = consider.Count()
			}
		}
	}

	return min, count, nil
}