// MedPrice - Median Price (h+l)/2
503121
func MedPrice(inHigh []float64, inLow []float64) []float64 {

	outReal := make([]float64, len(inHigh))
	outIdx := 0
	startIdx := 0

	for i := startIdx; i < len(inHigh); i++ {
		outReal[outIdx] = (inHigh[i] + inLow[i]) / 2.0
		outIdx++
	}
	return outReal
}
605146
func (s *Offering) SetUsagePrice(v float64) *Offering {
	s.UsagePrice = &v
	return s
}
454566
func (s *ReservedDBInstance) SetUsagePrice(v float64) *ReservedDBInstance {
	s.UsagePrice = &v
	return s
}
734601
func (s *ReservedCacheNode) SetUsagePrice(v float64) *ReservedCacheNode {
	s.UsagePrice = &v
	return s
}
552605
func parsePrice(data []string) *Price {
	p := &Price{}
	p.Bid, _ = strconv.ParseFloat(data[2], 64)
	p.Ask, _ = strconv.ParseFloat(data[3], 64)
	p.Open, _ = strconv.ParseFloat(data[4], 64)
	p.PreviousClose, _ = strconv.ParseFloat(data[5], 64)
	p.Last, _ = strconv.ParseFloat(data[6], 64)
	p.Date, _ = parseDate(data[7])

	return p
}
195028
func GetPrice(symbol string) (*Price, error) {
	data, err := loadSingleStockPrice(symbol)
	if err != nil {
		return nil, err
	}

	price := parsePrice(data)
	return price, nil
}
830380
func (s *ReservedCacheNodesOffering) SetFixedPrice(v float64) *ReservedCacheNodesOffering {
	s.FixedPrice = &v
	return s
}
1160317
func (col Color) Hsl() (h, s, l float64) {
	min := math.Min(math.Min(col.R, col.G), col.B)
	max := math.Max(math.Max(col.R, col.G), col.B)

	l = (max + min) / 2

	if min == max {
		s = 0
		h = 0
	} else {
		if l < 0.5 {
			s = (max - min) / (max + min)
		} else {
			s = (max - min) / (2.0 - max - min)
		}

		if max == col.R {
			h = (col.G - col.B) / (max - min)
		} else if max == col.G {
			h = 2.0 + (col.B-col.R)/(max-min)
		} else {
			h = 4.0 + (col.R-col.G)/(max-min)
		}

		h *= 60

		if h < 0 {
			h += 360
		}
	}

	return
}
220641
func (m *MovingMedian) Median() float64 {
	if len(m.queue) == 1 {
		return m.queue[0].f
	}

	if m.maxHeap.Len() == m.minHeap.Len() {
		return (m.maxHeap.itemHeap[0].f + m.minHeap.itemHeap[0].f) / 2
	}

	if m.maxHeap.Len() > m.minHeap.Len() {
		return m.maxHeap.itemHeap[0].f
	}

	return m.minHeap.itemHeap[0].f
}
508850
func (s *InstanceGroup) SetBidPrice(v string) *InstanceGroup {
	s.BidPrice = &v
	return s
}
1337270
func (h *Histogram) Mean() float64 {
	if h.totalCount == 0 {
		return 0
	}
	var total int64
	i := h.iterator()
	for i.next() {
		if i.countAtIdx != 0 {
			total += i.countAtIdx * h.medianEquivalentValue(i.valueFromIdx)
		}
	}
	return float64(total) / float64(h.totalCount)
}
773044
func GetPriceForDate(symbol string, date time.Time) (PriceH, error) {
	var price PriceH
	// We need to get price information for single date, so date passed to
	// this function will be used both for "from" and "to" arguments.
	data, err := loadHistoricalPrice(symbol, date, date, Daily)
	if err != nil {
		return price, err
	}

	prices, err := parseHistorical(data)
	if err != nil {
		return PriceH{}, err
	}
	price = prices[0]

	// Return single price.
	return price, nil
}
709051
func Price(min, max float64) float64 {
	return math.Floor(randFloat64Range(min, max)*100) / 100
}
1214152
func (s *Reservation) SetUsagePrice(v float64) *Reservation {
	s.UsagePrice = &v
	return s
}
552904
func (m1 Mat2) ApproxEqualThreshold(m2 Mat2, threshold float64) bool {
	for i := range m1 {
		if !FloatEqualThreshold(m1[i], m2[i], threshold) {
			return false
		}
	}
	return true
}
514520
func (s *CreateLaunchConfigurationInput) SetSpotPrice(v string) *CreateLaunchConfigurationInput {
	s.SpotPrice = &v
	return s
}
833838
func (s *ReservedCacheNode) SetFixedPrice(v float64) *ReservedCacheNode {
	s.FixedPrice = &v
	return s
}