// RoundDown rounds down to a given roundTo value.
163752
func (m mathUtil) RoundDown(value, roundTo float64) float64 {
	if roundTo < 0.000000000000001 {
		return value
	}
	d1 := math.Floor(value / roundTo)
	return d1 * roundTo
}
810068
func (s *SetLoadBasedAutoScalingInput) SetDownScaling(v *AutoScalingThresholds) *SetLoadBasedAutoScalingInput {
	s.DownScaling = v
	return s
}
1009327
func (c Context) RoundToInt(z *Big) *Big {
	if z.isSpecial() || z.exp >= 0 {
		return z
	}
	c.Precision = z.Precision()
	return c.Quantize(z, 0)
}
1124211
func (p *Point) Round(factor ...int) *Point {
	f := 1.0e5
	if len(factor) != 0 {
		f = float64(factor[0])
	}

	for idx, val := range p {
		x := val * f
		p[idx] = math.Floor(x+0.5) / f
	}

	return p
}
626016
func (a *decimal) RoundedInteger() uint64 {
	if a.dp > 20 {
		return 0xFFFFFFFFFFFFFFFF
	}
	var i int
	n := uint64(0)
	for i = 0; i < a.dp && i < a.nd; i++ {
		n = n*10 + uint64(a.d[i]-'0')
	}
	for ; i < a.dp; i++ {
		n *= 10
	}
	if shouldRoundUp(a, a.dp) {
		n++
	}
	return n
}
567542
func (q *Quantity) RoundUp(scale Scale) bool {
	if q.d.Dec != nil {
		q.s = ""
		d, exact := q.d.AsScale(scale)
		q.d = d
		return exact
	}
	// avoid clearing the string value if we have already calculated it
	if q.i.scale >= scale {
		return true
	}
	q.s = ""
	i, exact := q.i.AsScale(scale)
	q.i = i
	return exact
}
312935
func Round(g Geometry, factor ...int) Geometry {
	if g == nil {
		return nil
	}

	f := float64(DefaultRoundingFactor)
	if len(factor) > 0 {
		f = float64(factor[0])
	}

	switch g := g.(type) {
	case Point:
		return Point{
			math.Round(g[0]*f) / f,
			math.Round(g[1]*f) / f,
		}
	case MultiPoint:
		if g == nil {
			return nil
		}
		roundPoints([]Point(g), f)
		return g
	case LineString:
		if g == nil {
			return nil
		}
		roundPoints([]Point(g), f)
		return g
	case MultiLineString:
		if g == nil {
			return nil
		}
		for _, ls := range g {
			roundPoints([]Point(ls), f)
		}
		return g
	case Ring:
		if g == nil {
			return nil
		}
		roundPoints([]Point(g), f)
		return g
	case Polygon:
		if g == nil {
			return nil
		}
		for _, r := range g {
			roundPoints([]Point(r), f)
		}
		return g
	case MultiPolygon:
		if g == nil {
			return nil
		}
		for _, p := range g {
			for _, r := range p {
				roundPoints([]Point(r), f)
			}
		}
		return g
	case Collection:
		if g == nil {
			return nil
		}

		for i := range g {
			g[i] = Round(g[i], int(f))
		}
		return g
	case Bound:
		return Bound{
			Min: Point{
				math.Round(g.Min[0]*f) / f,
				math.Round(g.Min[1]*f) / f,
			},
			Max: Point{
				math.Round(g.Max[0]*f) / f,
				math.Round(g.Max[1]*f) / f,
			},
		}
	}

	panic(fmt.Sprintf("geometry type not supported: %T", g))
}
438098
func Round(x float64) float64 {
	t := math.Trunc(x)
	if math.Abs(x-t) >= 0.5 {
		return t + math.Copysign(1, x)
	}
	return t
}
1088804
func (b *BiMapper) ConvertDown(up []interface{}) []interface{} {
	if len(up) != len(b.UpTypes) {
		panic(fmt.Sprintf("Expected %d values != %d", len(b.UpTypes), len(up)))
	}
	upVals := make([]reflect.Value, len(b.UpTypes))
	for i, val := range up {
		if val == nil {
			upVals[i] = reflect.Zero(b.UpTypes[i])
		} else {
			upVals[i] = reflect.ValueOf(val)
		}
	}
	downVals := b.Downstream.Call(upVals)
	down := make([]interface{}, len(downVals))
	for i, downVal := range downVals {
		down[i] = downVal.Interface()
	}

	return down
}
1171807
func (c Context) Round(z *Big) *Big {
	if debug {
		z.validate()
	}
	if z.invalidContext(c) {
		return z
	}

	n := precision(c)
	if n == UnlimitedPrecision || z.isSpecial() {
		return z
	}

	zp := z.Precision()
	if zp <= n {
		return c.fix(z)
	}

	shift := zp - n
	if shift > c.maxScale() {
		return z.xflow(c.minScale(), false, true)
	}
	z.exp += shift

	z.Context.Conditions |= Rounded

	c.shiftr(z, uint64(shift))
	return c.fix(z)
}
1284905
func Roundf(a, b float32) float32 {
	if b == 0 {
		return 0
	}
	var m, v float32

	for {
		if b*m <= a {
			if b*(m+1) > a {
				if math.Abs(float64(a-b*m)) < math.Abs(float64(a-b*(m+1))) {
					v = b * m
				} else {
					v = b * (m + 1)
				}
				break
			}
			m++
			continue
		}
		m--
		if b*m <= a {
			if math.Abs(float64(a-b*m)) < math.Abs(float64(a-b*(m+1))) {
				v = b * m
			} else {
				v = b * (m + 1)
			}
			break
		}
	}
	return v
}
220351
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
	req2 := cloneRequest(req)
	for _, modifier := range t.Modifiers {
		if err := modifier.ModifyRequest(req2); err != nil {
			return nil, err
		}
	}

	t.setModReq(req, req2)
	res, err := t.base().RoundTrip(req2)
	if err != nil {
		t.setModReq(req, nil)
		return nil, err
	}
	res.Body = &onEOFReader{
		rc: res.Body,
		fn: func() { t.setModReq(req, nil) },
	}
	return res, nil
}
20496
func roundUp(n int) int {
	base := roundDown10(n)
	if n < (2 * base) {
		return 2 * base
	}
	if n < (5 * base) {
		return 5 * base
	}
	return 10 * base
}
312950
func (z *Dec) Round(x *Dec, s Scale, r Rounder) *Dec {
	return z.QuoRound(x, NewDec(1, 0), s, r)
}
1037946
func Round(v float64, precision int) float64 {
	p := float64(precision)
	t := float64(v) * math.Pow(10, p)
	if t > 0 {
		return float64(math.Floor(t+0.5) / math.Pow(10, p))
	}
	return float64(math.Ceil(t-0.5) / math.Pow(10, p))
}
651908
func (s *LoadBasedAutoScalingConfiguration) SetDownScaling(v *AutoScalingThresholds) *LoadBasedAutoScalingConfiguration {
	s.DownScaling = v
	return s
}
756666
func (t *xrayTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	s := ContextSegment(req.Context())
	if s == nil {
		return t.wrapped.RoundTrip(req)
	}

	sub := s.NewSubsegment(req.URL.Host)
	defer sub.Close()

	sub.RecordRequest(req, "remote")

	resp, err := t.wrapped.RoundTrip(req)

	if err != nil {
		sub.RecordError(err)
	} else {
		sub.RecordResponse(resp)
	}

	return resp, err
}