// RangeLowIncl represents the low end of a range to match against.  As
// the name suggests, the low end of the range is inclusive.
501922
func (n *Number) RangeLowIncl() *big.Rat {
	return new(big.Rat).Sub(n.Value, n.rangeDelta())
}
1081142
func Range(start, end int) []int {
	if end < start {
		panic("range must have end greater than or equal to start")
	}
	r := make([]int, end-start)
	for i := start; i < end; i++ {
		r[i-start] = i
	}
	return r
}
28571
func (b *rangeBuilder) Range() (*Range, error) {
	if b.err != nil {
		return nil, b.err
	}
	if b.r.from != nil && b.r.to != nil && *b.r.to < *b.r.from {
		return nil, ErrInvalidRange
	}
	return &b.r, nil
}
1216709
func (ha *ha_NE) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
173515
func (r Range) Equal(other Range) bool {
	return r.Start.Equal(other.Start) && r.End.Equal(other.End)
}
1337995
func (k *Key) RangeInt(defaultVal, min, max int) int {
	val := k.MustInt()
	if val < min || val > max {
		return defaultVal
	}
	return val
}
161118
func (es *es_CO) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
	return locales.PluralRuleOther
}
162977
func (t Tile) Range(z Zoom) (min, max Tile) {
	if z < t.Z {
		t = t.toZoom(z)
		return t, t
	}

	offset := z - t.Z
	return Tile{
			X: t.X << offset,
			Y: t.Y << offset,
			Z: z,
		}, Tile{
			X: ((t.X + 1) << offset) - 1,
			Y: ((t.Y + 1) << offset) - 1,
			Z: z,
		}
}
600322
func (db *DB) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator {
	return NewRangeLimitIterator(db.NewIterator(), &Range{min, max, rangeType}, &Limit{offset, count})
}
1085330
func (mr *mr_IN) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {

	start := mr.CardinalPluralRule(num1, v1)
	end := mr.CardinalPluralRule(num2, v2)

	if start == locales.PluralRuleOne && end == locales.PluralRuleOne {
		return locales.PluralRuleOne
	} else if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
		return locales.PluralRuleOther
	}

	return locales.PluralRuleOther

}
451764
func (n *node) RangeScan(min, max string) []Node {
	if n.tx != nil {
		return n.rangeScan(n.tx, min, max)
	}

	var nodes []Node

	n.readTx(func(tx *bolt.Tx) error {
		nodes = n.rangeScan(tx, min, max)
		return nil
	})

	return nodes
}
975755
func IPInRange(start, stop, ip net.IP) bool {
	return !(IPLess(ip, start) || IPLess(stop, ip))
}
944311
func (eng *engine) IndexRangeByLex(index Index, min, max string, opts ...RangeOption) (RangeLexResult, error) {
	s := eng.newSession()
	defer s.Close()
	action, result, err := s.indexRangeByLex(index, min, max, s.applyRangeOption(opts))
	if err != nil {
		return nil, s.catch("IndexRangeByLex: "+action, err)
	}
	return result, nil
}
1137968
func (d *Duration) InRange(min, max time.Duration) *Duration {
	if d.value == nil {
		d.chain.fail("expected duration is set, but it is not")
		return d
	}
	if !(*d.value >= min && *d.value <= max) {
		d.chain.fail(
			"\nexpected duration in range:\n min: %s\n max: %s\n\nbut got: %s",
			min, max, *d.value)
	}
	return d
}
860850
func range_(thread *Thread, fn *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
	var start, stop, step int
	step = 1
	if err := UnpackPositionalArgs("range", args, kwargs, 1, &start, &stop, &step); err != nil {
		return nil, err
	}

	// TODO(adonovan): analyze overflow/underflows cases for 32-bit implementations.

	var n int
	switch len(args) {
	case 1:
		// range(stop)
		start, stop = 0, start
		fallthrough
	case 2:
		// range(start, stop)
		if stop > start {
			n = stop - start
		}
	case 3:
		// range(start, stop, step)
		switch {
		case step > 0:
			if stop > start {
				n = (stop-1-start)/step + 1
			}
		case step < 0:
			if start > stop {
				n = (start-1-stop)/-step + 1
			}
		default:
			return nil, fmt.Errorf("range: step argument must not be zero")
		}
	}

	return rangeValue{start: start, stop: stop, step: step, len: n}, nil
}
446066
func (n *IntNode) adjustRange() {
	if n.Left == nil {
		n.Range.Start = n.Interval.Start
	} else {
		n.Range.Start = n.Left.Range.Start
	}
	n.Range.End = intMaxRange(n, n.Left, n.Right)
}
592927
func (k *Key) RangeInt64(defaultVal, min, max int64) int64 {
	val := k.MustInt64()
	if val < min || val > max {
		return defaultVal
	}
	return val
}