code: func quantile(q float64, values vectorByValueHeap) float64 {
  	if len(values) == 0 {
  		return math.NaN()
  	}
  	if q < 0 {
  		return math.Inf(-1)
  	}
  	if q > 1 {
  		return math.Inf(+1)
  	}
  	sort.Sort(values)
  
  	n := float64(len(values))
  	// When the quantile lies between two samples,
  	// we use a weighted average of the two samples.
  	rank := q * (n - 1)
  
  	lowerIndex := math.Max(0, math.Floor(rank))
  	upperIndex := math.Min(n-1, lowerIndex+1)
  
  	weight := rank - math.Floor(rank)
  	return values[int(lowerIndex)].V*(1-weight) + values[int(upperIndex)].V*weight
  }
docs: // qauntile calculates the given quantile of a vector of samples.
  //
  // The Vector will be sorted.
  // If 'values' has zero elements, NaN is returned.
  // If q<0, -Inf is returned.
  // If q>1, +Inf is returned.