code: func HistogramQuantile(hist Histogram, q float64) float64 {
  	under, counts, over := hist.Counts()
  	total := under + over
  	for _, count := range counts {
  		total += count
  	}
  
  	goal := uint(float64(total) * q)
  	if goal <= under || goal > total-over {
  		return math.NaN()
  	}
  	for bin, count := range counts {
  		if count > goal {
  			return hist.BinToValue(float64(bin) + float64(goal)/float64(count))
  		}
  		goal -= count
  	}
  	panic("goal count not reached")
  }
docs: // HistogramQuantile returns the x such that n*q samples in hist are
  // <= x, assuming values are distibuted within each bin according to
  // hist's distribution.
  //
  // If the q'th sample falls below the lowest bin or above the highest
  // bin, returns NaN.