// maxAngle returns the largest of the given values.
494007
func maxAngle(x s1.Angle, others ...s1.Angle) s1.Angle {
	max := x
	for _, y := range others {
		if y > max {
			max = y
		}
	}
	return max
}
398834
func InteriorAngle(p0, p1, p2 geom.Coord) float64 {
	anglePrev := Angle(p1, p0)
	angleNext := Angle(p1, p2)
	return math.Abs(angleNext - anglePrev)
}
176613
func (data ChartUints) snip(max int) ChartUints {
	if len(data) < max {
		max = len(data)
	}
	return data[:max]
}
744325
func max(values ...int) int {
	v := 0
	for _, i := range values {
		if i > v {
			v = i
		}
	}
	return v
}
335053
func (s *ConfigurationOptionDescription) SetMaxValue(v int64) *ConfigurationOptionDescription {
	s.MaxValue = &v
	return s
}
582662
func (l *Loop) turningAngleMaxError() float64 {
	// The maximum error can be bounded as follows:
	//   2.24 * dblEpsilon    for RobustCrossProd(b, a)
	//   2.24 * dblEpsilon    for RobustCrossProd(c, b)
	//   3.25 * dblEpsilon    for Angle()
	//   2.00 * dblEpsilon    for each addition in the Kahan summation
	//   ------------------
	//   9.73 * dblEpsilon
	maxErrorPerVertex := 9.73 * dblEpsilon
	return maxErrorPerVertex * float64(len(l.vertices))
}
405017
func maxInt64(ints ...int64) int64 {
	maxInt := ints[0]
	for i := 1; i < len(ints); i++ {
		if ints[i] > maxInt {
			maxInt = ints[i]
		}
	}

	return maxInt
}
156504
func minAngle(x s1.Angle, others ...s1.Angle) s1.Angle {
	min := x
	for _, y := range others {
		if y < min {
			min = y
		}
	}
	return min
}
775859
func (c Cell) MaxDistanceToCell(target Cell) s1.ChordAngle {
	// Need to check the antipodal target for intersection with the cell. If it
	// intersects, the distance is the straight ChordAngle.
	// antipodalUV is the transpose of the original UV, interpreted within the opposite face.
	antipodalUV := r2.Rect{target.uv.Y, target.uv.X}
	if int(c.face) == oppositeFace(int(target.face)) && c.uv.Intersects(antipodalUV) {
		return s1.StraightChordAngle
	}

	// Otherwise, the maximum distance always occurs between a vertex of one
	// cell and an edge of the other cell (including the edge endpoints).  This
	// represents a total of 32 possible (vertex, edge) pairs.
	//
	// TODO(roberts): When the maximum distance is at most π/2, the maximum is
	// always attained between a pair of vertices, and this could be made much
	// faster by testing each vertex pair once rather than the current 4 times.
	var va, vb [4]Point
	for i := 0; i < 4; i++ {
		va[i] = c.Vertex(i)
		vb[i] = target.Vertex(i)
	}
	maxDist := s1.NegativeChordAngle
	for i := 0; i < 4; i++ {
		for j := 0; j < 4; j++ {
			maxDist, _ = UpdateMaxDistance(va[i], vb[j], vb[(j+1)&3], maxDist)
			maxDist, _ = UpdateMaxDistance(vb[i], va[j], va[(j+1)&3], maxDist)
		}
	}
	return maxDist
}
346641
func MaxOf(a []float64) (retVal float64) {
	if len(a) < 1 {
		panic("Cannot find the max of an empty slice")
	}
	return Reduce(max, a[0], a[1:]...)
}
588712
func Max(x, y float32) float32 {
	return float32(math.Max(float64(x), float64(y)))
}
353198
func NewGLTriangles(shader *glhf.Shader, t pixel.Triangles) *GLTriangles {
	var gt *GLTriangles
	mainthread.Call(func() {
		gt = &GLTriangles{
			vs:     glhf.MakeVertexSlice(shader, 0, t.Len()),
			shader: shader,
		}
	})
	gt.SetLen(t.Len())
	gt.Update(t)
	return gt
}
953845
func maxfor(z *big.Int, n, sign int) {
	arith.Sub(z, arith.BigPow10(uint64(n)), 1)
	if sign < 0 {
		z.Neg(z)
	}
}
639189
func (h *Haptic) NumAxes() (int, error) {
	i := int(C.SDL_HapticNumAxes(h.cptr()))
	return i, errorFromInt(i)
}
485203
func Max(v1, v2 Value) (Value, error) {
	return minmax(v1, v2, false)
}
763546
func vectorMax(v mat.Vector) float64 {
	n_obs, _ := v.Dims()
	max := v.At(0, 0)
	for i := 0; i < n_obs; i++ {
		if v.At(i, 0) > max {
			max = v.At(i, 0)
		}
	}
	return max
}
595657
func maxCircle(c, d Circle) Circle {
	if c.Radius < d.Radius {
		return d
	}
	return c
}